javax.swing.JPanel.setAlignmentY()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(14.6k)|赞(0)|评价(0)|浏览(185)

本文整理了Java中javax.swing.JPanel.setAlignmentY()方法的一些代码示例,展示了JPanel.setAlignmentY()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JPanel.setAlignmentY()方法的具体详情如下:
包路径:javax.swing.JPanel
类名称:JPanel
方法名:setAlignmentY

JPanel.setAlignmentY介绍

暂无

代码示例

代码示例来源:origin: ron190/jsql-injection

arrowDownPanel.setAlignmentY(Component.TOP_ALIGNMENT);
MediatorGui.tabConsoles().setAlignmentX(FlowLayout.LEADING);
MediatorGui.tabConsoles().setAlignmentY(Component.TOP_ALIGNMENT);

代码示例来源:origin: ron190/jsql-injection

panelCombo.setAlignmentY(Component.BOTTOM_ALIGNMENT);
tabsBottom.setAlignmentX(FlowLayout.LEADING);
tabsBottom.setAlignmentY(Component.BOTTOM_ALIGNMENT);

代码示例来源:origin: stackoverflow.com

JPanel jpTop = new JPanel(new BorderLayout());
jbStop = new JButton("Cancel");
JPanel extraPanel = new JPanel();
extraPanel.setLayout(new BoxLayout(extraPanel, BoxLayout.X_AXIS));
extraPanel.setAlignmentY(Component.CENTER_ALIGNMENT);
extraPanel.add(jbStop);
jpTop .add(extraPanel, BorderLayout.EAST);

代码示例来源:origin: robo-code/robocode

private JPanel getDescriptionPanel() {
  if (descriptionPanel == null) {
    descriptionPanel = new JPanel();
    descriptionPanel.setAlignmentY(Component.CENTER_ALIGNMENT);
    descriptionPanel.setLayout(new BoxLayout(descriptionPanel, BoxLayout.Y_AXIS));
    descriptionPanel.setBorder(BorderFactory.createEtchedBorder());
    for (int i = 0; i < 3; i++) {
      descriptionPanel.add(getDescriptionLabel(i));
    }
  }
  return descriptionPanel;
}

代码示例来源:origin: stackoverflow.com

public class ButtonsPanel extends JPanel {
  public ButtonsPanel() {
    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
    add(Box.createHorizontalStrut(50));

    JPanel butts = new JPanel();
    butts.setLayout(new BoxLayout(butts, BoxLayout.Y_AXIS));
    butts.add(Box.createVerticalStrut(30));
    for (int i = 0; i < 5; i++) {
      JButton butt = new JButton("Button " + String.valueOf(i));
      butts.add(butt);
      butts.add(Box.createVerticalStrut(10));
    }
    butts.setAlignmentY(JPanel.TOP_ALIGNMENT);
    butts.add(Box.createVerticalStrut(40));

    add(butts);
    add(Box.createHorizontalStrut(50));
  }
}

代码示例来源:origin: com.tourgeek.thin.app/com.tourgeek.thin.app.booking

/**
 * Add any screen sub-panel(s) now.
 * You might want to override this to create an alternate parent screen.
 * @param parent The parent to add the new screen to.
 */
public boolean addSubPanels(Container parent)
{
  // There may be a better way of doing this, but this makes the screen top justified.
  parent.setLayout(new BoxLayout(parent, BoxLayout.X_AXIS));
  JPanel panelLeftTop = new JPanel();
  panelLeftTop.setOpaque(false);
  panelLeftTop.setAlignmentY(JLabel.TOP_ALIGNMENT);
  parent.add(panelLeftTop);
  JPanel panelLeft = new JPanel();
  panelLeft.setOpaque(false);
  panelLeftTop.add(panelLeft);        
  return super.addSubPanels(panelLeft);
}
/**

代码示例来源:origin: com.tourgeek.thin.app/com.tourgeek.thin.app.booking

/**
 * Add any screen sub-panel(s) now.
 * You might want to override this to create an alternate parent screen.
 * @param parent The parent to add the new screen to.
 */
public boolean addSubPanels(Container parent)
{
  // There may be a better way of doing this, but this makes the screen top justified.
  parent.setLayout(new BoxLayout(parent, BoxLayout.X_AXIS));
  JPanel panelLeftTop = new JPanel();
  panelLeftTop.setOpaque(false);
  panelLeftTop.setAlignmentY(JLabel.TOP_ALIGNMENT);
  parent.add(panelLeftTop);
  JPanel panelLeft = new JPanel();
  panelLeft.setOpaque(false);
  panelLeftTop.add(panelLeft);        
  super.addSubPanels(panelLeft);
  return true;
}
/**

代码示例来源:origin: org.codehaus.izpack/izpack-panel

public CheckBoxNodeRenderer(TreePacksPanel t)
{
  selectionForeground = UIManager.getColor("Tree.selectionForeground");
  selectionBackground = UIManager.getColor("Tree.selectionBackground");
  textForeground = UIManager.getColor("Tree.textForeground");
  textBackground = UIManager.getColor("Tree.textBackground");
  treePacksPanel = t;
  int treeWidth = t.getTree().getPreferredSize().width;
  int height = checkbox.getPreferredSize().height;
  int cellWidth = treeWidth - treeWidth / 4;
  //Don't touch, it fixes various layout bugs in swing/awt
  rendererPanel.setLayout(new BorderLayout(0, 0));
  rendererPanel.setBackground(textBackground);
  rendererPanel.add(BorderLayout.WEST, checkbox);
  rendererPanel.setAlignmentX((float) 0);
  rendererPanel.setAlignmentY((float) 0);
  rendererPanel.add(BorderLayout.EAST, packSizeLabel);
  rendererPanel.setMinimumSize(new Dimension(cellWidth, height));
  rendererPanel.setPreferredSize(new Dimension(cellWidth, height));
  rendererPanel.setSize(new Dimension(cellWidth, height));
  rendererPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
}

代码示例来源:origin: nroduit/Weasis

public JPanel getCtrlSearchPanel() {
  final JPanel panel5 = new JPanel();
  panel5.setAlignmentY(Component.TOP_ALIGNMENT);
  panel5.setAlignmentX(Component.LEFT_ALIGNMENT);
  panel5.setLayout(new FlowLayout(FlowLayout.LEFT, 15, 10));
  panel5.add(Box.createHorizontalStrut(350));
  JButton clearBtn = new JButton(Messages.getString("DicomQrView.clear")); //$NON-NLS-1$
  clearBtn.setToolTipText(Messages.getString("DicomQrView.clear_search")); //$NON-NLS-1$
  clearBtn.addActionListener(e -> clearItems());
  panel5.add(clearBtn);
  JButton searchBtn = new JButton(Messages.getString("DicomQrView.search")); //$NON-NLS-1$
  searchBtn.setToolTipText(Messages.getString("DicomQrView.tips_dcm_query")); //$NON-NLS-1$
  searchBtn.addActionListener(e -> cfind());
  panel5.add(searchBtn);
  return panel5;
}

代码示例来源:origin: nroduit/Weasis

public JPanel getMarkerPanel() {
  final JPanel transform = new JPanel();
  transform.setAlignmentY(Component.TOP_ALIGNMENT);
  transform.setAlignmentX(Component.LEFT_ALIGNMENT);
  transform.setLayout(new BoxLayout(transform, BoxLayout.Y_AXIS));
  transform.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(10, 3, 0, 3),
    new TitledBorder(null, "Markers", //$NON-NLS-1$
      TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, FontTools.getFont12Bold(),
      Color.GRAY)));
  JPanel panel1 = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
  transform.add(panel1);
  transform.add(Box.createVerticalStrut(5));
  jtableMarker = createMultipleRenderingTable(new SimpleTableModel(new String[] {}, new Object[][] {}));
  jtableMarker.setFont(FontTools.getFont10());
  jtableMarker.getTableHeader().setReorderingAllowed(false);
  tableMarkerContainer.setBorder(BorderFactory.createEtchedBorder());
  tableMarkerContainer.setPreferredSize(new Dimension(50, 80));
  tableMarkerContainer.setLayout(new BorderLayout());
  transform.add(tableMarkerContainer);
  return transform;
}

代码示例来源:origin: nroduit/Weasis

public final JPanel getAnnotationsPanel() {
  final JPanel transform = new JPanel();
  transform.setAlignmentY(Component.TOP_ALIGNMENT);
  transform.setAlignmentX(Component.LEFT_ALIGNMENT);
  transform.setLayout(new BoxLayout(transform, BoxLayout.Y_AXIS));
  transform.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(10, 3, 0, 3),
    new TitledBorder(null, "Annotations", //$NON-NLS-1$
      TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, FontTools.getFont12Bold(),
      Color.GRAY)));
  JPanel panel1 = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
  transform.add(panel1);
  transform.add(Box.createVerticalStrut(5));
  jtableTag = createMultipleRenderingTable(new SimpleTableModel(new String[] {}, new Object[][] {}));
  jtableTag.setFont(FontTools.getFont10());
  jtableTag.getTableHeader().setReorderingAllowed(false);
  tableTagContainer.setBorder(BorderFactory.createEtchedBorder());
  tableTagContainer.setPreferredSize(new Dimension(50, 80));
  tableTagContainer.setLayout(new BorderLayout());
  transform.add(tableTagContainer);
  return transform;
}

代码示例来源:origin: nroduit/Weasis

public ContrastPanel() {
  super();
  setLayout(new BorderLayout());
  setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
  autoLevelListener = new AutoLevelListener();
  autoLevelBtn.addActionListener(autoLevelListener);
  contrastPanel = new ContrastComponent(this);
  brightnessPanel = new BrightnessComponent(this);
  JPanel content = new JPanel(new GridLayout(3, 1, 0, 10));
  content.setAlignmentX(Component.LEFT_ALIGNMENT);
  content.setAlignmentY(Component.TOP_ALIGNMENT);
  content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));
  content.add(contrastPanel);
  content.add(brightnessPanel);
  content.add(autoLevelBtn);
  add(content, BorderLayout.NORTH);
}

代码示例来源:origin: nroduit/Weasis

public JPanel getArchivePanel() {
  final JPanel sPanel = new JPanel();
  sPanel.setAlignmentY(Component.TOP_ALIGNMENT);
  sPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
  sPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 3, 3));
  JLabel lblDest = new JLabel(Messages.getString("DicomQrView.arc") + StringUtil.COLON); //$NON-NLS-1$
  sPanel.add(lblDest);
  JMVUtils.setPreferredWidth(comboDestinationNode, 185, 185);
  AbstractDicomNode.addTooltipToComboList(comboDestinationNode);
  sPanel.add(comboDestinationNode);
  sPanel.add(Box.createHorizontalStrut(10));
  JLabel lblTetrieve = new JLabel(Messages.getString("DicomQrView.retrieve") + StringUtil.COLON); //$NON-NLS-1$
  sPanel.add(lblTetrieve);
  comboDicomRetrieveType.setToolTipText(Messages.getString("DicomQrView.msg_sel_type")); //$NON-NLS-1$
  sPanel.add(comboDicomRetrieveType);
  return sPanel;
}

代码示例来源:origin: nroduit/Weasis

public JPanel getSelectedMeasurePanel() {
  final JPanel transform = new JPanel();
  transform.setAlignmentY(Component.TOP_ALIGNMENT);
  transform.setAlignmentX(Component.LEFT_ALIGNMENT);
  transform.setLayout(new BoxLayout(transform, BoxLayout.Y_AXIS));
  transform.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(10, 3, 0, 3),
    new TitledBorder(null, Messages.getString("MeasureTool.sel"), //$NON-NLS-1$
      TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, FontTools.getFont12Bold(),
      Color.GRAY)));
  JPanel panel1 = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
  transform.add(panel1);
  transform.add(Box.createVerticalStrut(5));
  jtable = createMultipleRenderingTable(new SimpleTableModel(new String[] {}, new Object[][] {}));
  jtable.setFont(FontTools.getFont10());
  jtable.getTableHeader().setReorderingAllowed(false);
  tableContainer = new JPanel();
  tableContainer.setBorder(BorderFactory.createEtchedBorder());
  tableContainer.setPreferredSize(new Dimension(50, 80));
  tableContainer.setLayout(new BorderLayout());
  transform.add(tableContainer);
  return transform;
}

代码示例来源:origin: nroduit/Weasis

public JPanel getResetPanel() {
  final JPanel panel2 = new JPanel();
  panel2.setAlignmentY(Component.TOP_ALIGNMENT);
  panel2.setAlignmentX(Component.LEFT_ALIGNMENT);
  panel2.setLayout(new FlowLayout(FlowLayout.LEFT, 3, 3));
  panel2.setBorder(
    BorderFactory.createCompoundBorder(spaceY, new TitledBorder(null, Messages.getString("ResetTools.reset"), //$NON-NLS-1$
      TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, TITLE_FONT, TITLE_COLOR)));
  final JComboBox resetComboBox = new JComboBox(ResetTools.values());
  panel2.add(resetComboBox);
  final JButton resetButton = new JButton();
  resetButton.setText(Messages.getString("ResetTools.reset")); //$NON-NLS-1$
  resetButton
    .addActionListener(e -> EventManager.getInstance().reset((ResetTools) resetComboBox.getSelectedItem()));
  panel2.add(resetButton);
  ActionState resetAction = EventManager.getInstance().getAction(ActionW.RESET);
  if (resetAction != null) {
    resetAction.registerActionState(resetButton);
  }
  return panel2;
}

代码示例来源:origin: nroduit/Weasis

public JPanel getResetPanel() {
  final JPanel panel2 = new JPanel();
  panel2.setAlignmentY(Component.TOP_ALIGNMENT);
  panel2.setAlignmentX(Component.LEFT_ALIGNMENT);
  panel2.setLayout(new FlowLayout(FlowLayout.LEFT, 3, 3));
  panel2.setBorder(
    BorderFactory.createCompoundBorder(spaceY, new TitledBorder(null, Messages.getString("ImageTool.reset"), //$NON-NLS-1$
      TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, TITLE_FONT, TITLE_COLOR)));
  final JComboBox resetComboBox = new JComboBox(ResetTools.values());
  panel2.add(resetComboBox);
  final JButton resetButton = new JButton();
  resetButton.setText(Messages.getString("ImageTool.reset")); //$NON-NLS-1$
  resetButton
    .addActionListener(e -> EventManager.getInstance().reset((ResetTools) resetComboBox.getSelectedItem()));
  panel2.add(resetButton);
  ActionState resetAction = EventManager.getInstance().getAction(ActionW.RESET);
  if (resetAction != null) {
    resetAction.registerActionState(resetButton);
  }
  return panel2;
}

代码示例来源:origin: nroduit/Weasis

public JPanel getCallingNodePanel() {
  final JPanel sPanel = new JPanel();
  sPanel.setAlignmentY(Component.TOP_ALIGNMENT);
  sPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
  sPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 3, 3));
  final JLabel lblDest = new JLabel(Messages.getString("DicomQrView.calling_node") + StringUtil.COLON); //$NON-NLS-1$
  sPanel.add(lblDest);
  JMVUtils.setPreferredWidth(comboCallingNode, 185, 185);
  AbstractDicomNode.addTooltipToComboList(comboCallingNode);
  sPanel.add(comboCallingNode);
  sPanel.add(Box.createHorizontalStrut(10));
  final JButton btnGerenralOptions = new JButton(Messages.getString("DicomQrView.more_opt")); //$NON-NLS-1$
  btnGerenralOptions.setAlignmentX(Component.LEFT_ALIGNMENT);
  sPanel.add(btnGerenralOptions);
  btnGerenralOptions.addActionListener(e -> {
    PreferenceDialog dialog = new PreferenceDialog(SwingUtilities.getWindowAncestor(this));
    dialog.showPage(org.weasis.dicom.explorer.Messages.getString("DicomNodeListView.node_list")); //$NON-NLS-1$
    JMVUtils.showCenterScreen(dialog);
    initNodeList();
  });
  return sPanel;
}

代码示例来源:origin: nroduit/Weasis

private void jbInit() {
  setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
  add(getWindowLevelPanel());
  add(getTransformPanel());
  add(getSlicePanel());
  add(getResetPanel());
  final JPanel panel1 = new JPanel();
  panel1.setAlignmentY(Component.TOP_ALIGNMENT);
  panel1.setAlignmentX(Component.LEFT_ALIGNMENT);
  panel1.setLayout(new GridBagLayout());
  add(panel1);
}

代码示例来源:origin: nroduit/Weasis

private void jbInit() {
  setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
  add(getWindowLevelPanel());
  add(getTransformPanel());
  add(getSlicePanel());
  add(getResetPanel());
  final JPanel panel1 = new JPanel();
  panel1.setAlignmentY(Component.TOP_ALIGNMENT);
  panel1.setAlignmentX(Component.LEFT_ALIGNMENT);
  panel1.setLayout(new GridBagLayout());
  add(panel1);
}

代码示例来源:origin: com.tourgeek.thin.app/com.tourgeek.thin.app.booking

/**
 * Create the button panel.
 */
public JPanel createButtonPanel(BaseApplet applet)
{
  JPanel buttonPanel = new JPanel();
  buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
  buttonPanel.setOpaque(false);
  buttonPanel.setAlignmentX(LEFT_ALIGNMENT);
  buttonPanel.setAlignmentY(TOP_ALIGNMENT);
  ButtonGroup buttonGroup = new ButtonGroup();    //?
  this.addSearchButton(applet, buttonGroup, buttonPanel, ProductConstants.TOUR, false);
  this.addSearchButton(applet, buttonGroup, buttonPanel, ProductConstants.AIR, false);
  this.addSearchButton(applet, buttonGroup, buttonPanel, ProductConstants.HOTEL, false);
  this.addSearchButton(applet, buttonGroup, buttonPanel, ProductConstants.LAND, false);
  this.addSearchButton(applet, buttonGroup, buttonPanel, ProductConstants.CAR, false);
  this.addSearchButton(applet, buttonGroup, buttonPanel, ProductConstants.TRANSPORTATION, false);
  this.addSearchButton(applet, buttonGroup, buttonPanel, ProductConstants.CRUISE, false);
  this.addSearchButton(applet, buttonGroup, buttonPanel, ProductConstants.ITEM, false);
  return buttonPanel;
}
/**

相关文章

微信公众号

最新文章

更多

JPanel类方法