List of usage examples for java.awt Component TOP_ALIGNMENT
float TOP_ALIGNMENT
To view the source code for java.awt Component TOP_ALIGNMENT.
Click Source Link
From source file:AlignY.java
public static void main(String args[]) { JFrame frame = new JFrame("Y Alignment"); JPanel contentPane = (JPanel) frame.getContentPane(); BoxLayout layout = new BoxLayout(contentPane, BoxLayout.X_AXIS); contentPane.setLayout(layout);//w w w . j a v a 2s .co m JButton button = new JButton("0.0"); button.setAlignmentY(Component.TOP_ALIGNMENT); contentPane.add(button); button = new JButton("1.0"); button.setAlignmentY(Component.BOTTOM_ALIGNMENT); contentPane.add(button); button = new JButton("0.5"); button.setAlignmentY(Component.CENTER_ALIGNMENT); contentPane.add(button); frame.setSize(200, 100); frame.show(); }
From source file:MainClass.java
public static void main(String[] a) { JFrame frame = new JFrame("Alignment Example"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); String labels[] = { "--", "----", "--------", "------------" }; JPanel container = new JPanel(); BoxLayout layout = new BoxLayout(container, BoxLayout.X_AXIS); container.setLayout(layout);//from ww w .j a va 2s .co m for (int i = 0; i < labels.length; i++) { JButton button = new JButton(labels[i]); button.setAlignmentX(Component.TOP_ALIGNMENT); container.add(button); } frame.add(container, BorderLayout.CENTER); frame.setSize(300, 200); frame.setVisible(true); }
From source file:XAxisAlignY.java
public static void main(String args[]) { JFrame frame = new JFrame("Alignment Example"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container panel1 = makeIt("Top", Component.TOP_ALIGNMENT); Container panel2 = makeIt("Center", Component.CENTER_ALIGNMENT); Container panel3 = makeIt("Bottom", Component.BOTTOM_ALIGNMENT); Container contentPane = frame.getContentPane(); contentPane.setLayout(new GridLayout(1, 3)); contentPane.add(panel1);//from ww w. j a va2 s . c o m contentPane.add(panel2); contentPane.add(panel3); frame.setSize(423, 171); frame.setVisible(true); }
From source file:XAxisAlignY.java
public static void main(String args[]) { JFrame frame = new JFrame("Alignment Example"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container panel1 = layoutComponents("Top", Component.TOP_ALIGNMENT); Container panel2 = layoutComponents("Center", Component.CENTER_ALIGNMENT); Container panel3 = layoutComponents("Bottom", Component.BOTTOM_ALIGNMENT); frame.setLayout(new GridLayout(1, 3)); frame.add(panel1);//from w w w .jav a 2 s . co m frame.add(panel2); frame.add(panel3); frame.setSize(400, 150); frame.setVisible(true); }
From source file:XAxisDiffAlign.java
private static Container makeIt(String title, boolean more) { JPanel container = new JPanel() { public void paintComponent(Graphics g) { super.paintComponent(g); Insets insets = getInsets(); int width = getWidth(); int height = getHeight() - insets.top - insets.bottom; int halfHeight = height / 2 + insets.top; g.drawLine(0, halfHeight, width, halfHeight); }/*from w w w. j av a 2 s . com*/ }; container.setBorder(BorderFactory.createTitledBorder(title)); BoxLayout layout = new BoxLayout(container, BoxLayout.X_AXIS); container.setLayout(layout); JButton button; button = new JButton("0.0"); button.setOpaque(false); button.setAlignmentY(Component.TOP_ALIGNMENT); container.add(button); if (more) { button = new JButton(".25"); button.setOpaque(false); button.setAlignmentY(0.25f); container.add(button); button = new JButton(".5"); button.setOpaque(false); button.setAlignmentY(Component.CENTER_ALIGNMENT); container.add(button); button = new JButton(".75"); button.setOpaque(false); button.setAlignmentY(0.75f); container.add(button); } button = new JButton("1.0"); button.setOpaque(false); button.setAlignmentY(Component.BOTTOM_ALIGNMENT); container.add(button); return container; }
From source file:org.jfree.chart.demo.LeftPanel.java
public LeftPanel(ArrayList<ChartPanel> graphics, ArrayList<Graphic> Grafs, ArrayList<JFreeChart> charts, ArrayList<XYSeries> Series) { //setBackground(new Color(152 ,134, 202)); //setBackground(new Color(234 ,247, 202)); setSize(800, 530);/*from w ww . j a va2s . co m*/ setLayout(null); setBackground(new Color(176, 199, 246)); JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); tabbedPane.setBackground(new Color(174, 250, 127)); tabbedPane.setFont(new Font("Arial", 15, 16)); tabbedPane.setOpaque(false); tabbedPane.setBounds(7, 6, 750, 505); tabbedPane.setAlignmentY(Component.TOP_ALIGNMENT); add(tabbedPane); JPanel panel = new JPanel(); panel.setBackground(new Color(176, 199, 246)); panel.setToolTipText("Graphic 1"); panel.add(graphics.get(0)); panel.add(new bottom_slider(new Color(176, 199, 246), charts, Grafs.get(0), 0)); tabbedPane.addTab("Graphic 1", null, panel, null); panel.setLayout(null); JPanel panel_2 = new JPanel(); panel_2.add(graphics.get(1)); tabbedPane.addTab("Graphic 2", null, panel_2, null); panel_2.setLayout(null); panel_2.setBackground(new Color(176, 199, 246)); panel_2.add(new bottom_slider(new Color(176, 199, 246), charts, Grafs.get(1), 1)); JPanel panel_1 = new JPanel(); panel_1.add(graphics.get(2)); tabbedPane.addTab("Graphic 3", null, panel_1, null); panel_1.setLayout(null); panel_1.setBackground(new Color(176, 199, 246)); panel_1.add(new bottom_slider(new Color(176, 199, 246), charts, Grafs.get(2), 2)); panel_1.setBackground(new Color(176, 199, 246)); JPanel panel_3 = new JPanel(); panel_3.add(graphics.get(3)); tabbedPane.addTab("Graphic 4", null, panel_3, null); panel_3.setLayout(null); panel_3.setBackground(new Color(176, 199, 246)); panel_3.add(new bottom_slider(new Color(176, 199, 246), charts, Grafs.get(3), 3)); JPanel panel_4 = new JPanel(); panel_4.add(graphics.get(4)); tabbedPane.addTab("Graphic 5 ", null, panel_4, null); panel_4.setLayout(null); panel_4.setBackground(new Color(176, 199, 246)); panel_4.add(new bottom_slider(new Color(176, 199, 246), charts, Grafs.get(4), 4)); JPanel panel_5 = new JPanel(); panel_5.add(graphics.get(5)); tabbedPane.addTab("Graphic 6", null, panel_5, null); panel_5.setLayout(null); panel_5.setBackground(new Color(176, 199, 246)); panel_5.add(new bottom_slider(new Color(176, 199, 246), charts, Grafs.get(5), 5)); JPanel panel_6 = new JPanel(); panel_6.add(graphics.get(6)); tabbedPane.addTab("Graphic 7", null, panel_6, null); panel_6.setLayout(null); panel_6.setBackground(new Color(176, 199, 246)); panel_6.add(new bottom_slider(new Color(176, 199, 246), charts, Grafs.get(6), 6)); JPanel panel_7 = new JPanel(); panel_7.add(graphics.get(7)); tabbedPane.addTab("Graphic 8", null, panel_7, null); panel_7.setLayout(null); panel_7.setBackground(new Color(176, 199, 246)); panel_7.add(new bottom_slider(new Color(176, 199, 246), charts, Grafs.get(7), 7)); JPanel panel_8 = new JPanel(); panel_8.add(new Bottom_panel(Grafs, Series, 5, 390, 735, 50)); graphics.set(8, Grafs.get(8).get_ChartPanel(740, 390)); panel_8.add(graphics.get(8)); tabbedPane.addTab("Graphic 9", null, panel_8, null); panel_8.setLayout(null); panel_8.setBackground(new Color(176, 199, 246)); JPanel panel_9 = new JPanel(); panel_9.add(graphics.get(9)); tabbedPane.addTab("Graphic 10", null, panel_9, null); panel_9.setLayout(null); panel_9.setBackground(new Color(176, 199, 246)); }
From source file:au.org.ala.delta.intkey.ui.FindInTaxaDialog.java
public FindInTaxaDialog(Intkey intkeyApp) { super(intkeyApp.getMainFrame(), false); setResizable(false);/*from w ww .j a v a 2 s .c om*/ ResourceMap resourceMap = Application.getInstance().getContext().getResourceMap(FindInTaxaDialog.class); resourceMap.injectFields(this); ActionMap actionMap = Application.getInstance().getContext().getActionMap(this); _intkeyApp = intkeyApp; _numMatchedTaxa = 0; _currentMatchedTaxon = -1; _findAction = actionMap.get("findTaxa"); _nextAction = actionMap.get("nextFoundTaxon"); this.setTitle(windowTitle); getContentPane().setLayout(new BorderLayout(0, 0)); _pnlMain = new JPanel(); _pnlMain.setBorder(new EmptyBorder(20, 20, 20, 20)); getContentPane().add(_pnlMain, BorderLayout.CENTER); _pnlMain.setLayout(new BorderLayout(0, 0)); _pnlMainTop = new JPanel(); _pnlMain.add(_pnlMainTop, BorderLayout.NORTH); _pnlMainTop.setLayout(new BoxLayout(_pnlMainTop, BoxLayout.Y_AXIS)); _lblEnterSearchString = new JLabel(enterSearchStringCaption); _lblEnterSearchString.setBorder(new EmptyBorder(0, 0, 5, 0)); _lblEnterSearchString.setHorizontalAlignment(SwingConstants.LEFT); _lblEnterSearchString.setVerticalAlignment(SwingConstants.TOP); _lblEnterSearchString.setAlignmentY(Component.TOP_ALIGNMENT); _pnlMainTop.add(_lblEnterSearchString); _textField = new JTextField(); _textField.getDocument().addDocumentListener(new DocumentListener() { @Override public void removeUpdate(DocumentEvent e) { reset(); } @Override public void insertUpdate(DocumentEvent e) { reset(); } @Override public void changedUpdate(DocumentEvent e) { reset(); } }); _pnlMainTop.add(_textField); _textField.setColumns(10); _pnlMainMiddle = new JPanel(); _pnlMainMiddle.setBorder(new EmptyBorder(10, 0, 0, 0)); _pnlMain.add(_pnlMainMiddle, BorderLayout.CENTER); _pnlMainMiddle.setLayout(new BoxLayout(_pnlMainMiddle, BoxLayout.Y_AXIS)); _rdbtnSelectOne = new JRadioButton(selectOneCaption); _rdbtnSelectOne.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { reset(); } }); _pnlMainMiddle.add(_rdbtnSelectOne); _rdbtnSelectAll = new JRadioButton(selectAllCaption); _rdbtnSelectAll.setSelected(true); _rdbtnSelectAll.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { reset(); } }); _pnlMainMiddle.add(_rdbtnSelectAll); ButtonGroup radioButtonGroup = new ButtonGroup(); radioButtonGroup.add(_rdbtnSelectOne); radioButtonGroup.add(_rdbtnSelectAll); _pnlMainBottom = new JPanel(); _pnlMain.add(_pnlMainBottom, BorderLayout.SOUTH); _pnlMainBottom.setLayout(new BoxLayout(_pnlMainBottom, BoxLayout.Y_AXIS)); _chckbxSearchSynonyms = new JCheckBox(searchSynonymsCaption); _chckbxSearchSynonyms.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { reset(); } }); _pnlMainBottom.add(_chckbxSearchSynonyms); _chckbxSearchEliminatedTaxa = new JCheckBox(searchEliminatedTaxaCaption); _chckbxSearchEliminatedTaxa.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { reset(); } }); _pnlMainBottom.add(_chckbxSearchEliminatedTaxa); _pnlButtons = new JPanel(); _pnlButtons.setBorder(new EmptyBorder(20, 0, 0, 10)); getContentPane().add(_pnlButtons, BorderLayout.EAST); _pnlButtons.setLayout(new BorderLayout(0, 0)); _pnlInnerButtons = new JPanel(); _pnlButtons.add(_pnlInnerButtons, BorderLayout.NORTH); GridBagLayout gbl_pnlInnerButtons = new GridBagLayout(); gbl_pnlInnerButtons.columnWidths = new int[] { 0, 0 }; gbl_pnlInnerButtons.rowHeights = new int[] { 0, 0, 0, 0 }; gbl_pnlInnerButtons.columnWeights = new double[] { 0.0, Double.MIN_VALUE }; gbl_pnlInnerButtons.rowWeights = new double[] { 0.0, 0.0, 0.0, Double.MIN_VALUE }; _pnlInnerButtons.setLayout(gbl_pnlInnerButtons); _btnFindNext = new JButton(); _btnFindNext.setAction(_findAction); GridBagConstraints gbc_btnFind = new GridBagConstraints(); gbc_btnFind.fill = GridBagConstraints.HORIZONTAL; gbc_btnFind.insets = new Insets(0, 0, 5, 0); gbc_btnFind.gridx = 0; gbc_btnFind.gridy = 0; _pnlInnerButtons.add(_btnFindNext, gbc_btnFind); _btnPrevious = new JButton(); _btnPrevious.setAction(actionMap.get("previousFoundTaxon")); _btnPrevious.setEnabled(false); GridBagConstraints gbc_btnPrevious = new GridBagConstraints(); gbc_btnPrevious.insets = new Insets(0, 0, 5, 0); gbc_btnPrevious.gridx = 0; gbc_btnPrevious.gridy = 1; _pnlInnerButtons.add(_btnPrevious, gbc_btnPrevious); _btnDone = new JButton(); _btnDone.setAction(actionMap.get("findTaxaDone")); GridBagConstraints gbc_btnDone = new GridBagConstraints(); gbc_btnDone.fill = GridBagConstraints.HORIZONTAL; gbc_btnDone.gridx = 0; gbc_btnDone.gridy = 2; _pnlInnerButtons.add(_btnDone, gbc_btnDone); this.pack(); this.setLocationRelativeTo(_intkeyApp.getMainFrame()); }
From source file:lisong_mechlab.view.graphs.SustainedDpsGraph.java
/** * Creates and displays the {@link SustainedDpsGraph}. * /*from ww w. j a v a2s . c om*/ * @param aLoadout * Which load out the diagram is for. * @param aXbar * A {@link MessageXBar} to listen for changes to the loadout on. * @param aMaxSustainedDpsMetric * A {@link MaxSustainedDPS} instance to use in calculation. */ public SustainedDpsGraph(LoadoutBase<?> aLoadout, MessageXBar aXbar, MaxSustainedDPS aMaxSustainedDpsMetric) { super("Max Sustained DPS over range for " + aLoadout); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); aXbar.attach(this); loadout = aLoadout; maxSustainedDPS = aMaxSustainedDpsMetric; chartPanel = new ChartPanel(makechart()); setContentPane(chartPanel); chartPanel.setLayout(new OverlayLayout(chartPanel)); JButton button = new JButton( new OpenHelp("What is this?", "Max-sustained-dps-graph", KeyStroke.getKeyStroke('w'))); button.setMargin(new Insets(5, 5, 5, 5)); button.setFocusable(false); button.setAlignmentX(Component.RIGHT_ALIGNMENT); button.setAlignmentY(Component.TOP_ALIGNMENT); chartPanel.add(button); setIconImage(ProgramInit.programIcon); setSize(800, 600); setVisible(true); }
From source file:nz.govt.natlib.ndha.manualdeposit.StructMapFileDescManagement.java
private void initComponents() { scrlDescription = new javax.swing.JScrollPane(); lstDescription = new javax.swing.JList(); pnlDetails = new javax.swing.JPanel(); btnMoveUp = new javax.swing.JButton(); btnMoveDown = new javax.swing.JButton(); btnAddNew = new javax.swing.JButton(); btnDelete = new javax.swing.JButton(); btnSave = new javax.swing.JButton(); btnCancel = new javax.swing.JButton(); btnClose = new javax.swing.JButton(); btnGenMainDesc = new javax.swing.JButton(); setTitle("Manage Structure Map File Descriptions"); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); addWindowListener(new java.awt.event.WindowAdapter() { public void windowOpened(java.awt.event.WindowEvent evt) { formWindowOpened(evt);//from ww w .jav a2s . c o m } public void windowClosing(java.awt.event.WindowEvent evt) { dialogWindowClosing(evt); } }); scrlDescription.setViewportView(lstDescription); JPanel panelLayer1 = new JPanel(); panelLayer1.setAlignmentY(Component.TOP_ALIGNMENT); panel_ExtraLayers = new JPanel(); panel_ExtraLayers.setAlignmentY(Component.TOP_ALIGNMENT); panel_ExtraLayers.setMinimumSize(new Dimension(300, 0)); panel_ExtraLayers.setPreferredSize(new Dimension(300, 500)); panel_ExtraLayers.setMaximumSize(new Dimension(300, 500)); panel_ExtraLayers.setVisible(false); JLabel lblDescriptionL2 = new JLabel("Layer 2"); lblDescriptionL2.setFont(new Font("Tahoma", Font.PLAIN, 11)); JLabel lblDescription_1 = new JLabel("Description"); textfldDescriptionL2 = new JTextField(); textfldDescriptionL2.setName("DescriptionL2"); textfldDescriptionL2.setColumns(10); JLabel lblFilePrefixL2 = new JLabel("File Prefix/Suffix"); textfldFilePrefixL2 = new JTextField(); textfldFilePrefixL2.setName("FilePrefixL2"); textfldFilePrefixL2.setColumns(10); JLabel lblAllowMultiplesL2 = new JLabel("Allow Multiples?"); checkAllowMultiplesL2 = new JCheckBox(""); checkAllowMultiplesL2.setName("AllowMultiplesL2"); JLabel lblDescriptionL3 = new JLabel("Layer 3"); lblDescriptionL3.setFont(new Font("Tahoma", Font.PLAIN, 11)); JLabel lblDescription_2 = new JLabel("Description"); textfldDescriptionL3 = new JTextField(); textfldDescriptionL3.setName("DescriptionL3"); textfldDescriptionL3.setColumns(10); JLabel lblFilePrefixL3 = new JLabel("File Prefix/Suffix"); textfldFilePrefixL3 = new JTextField(); textfldFilePrefixL3.setName("FilePrefixL3"); textfldFilePrefixL3.setColumns(10); JLabel lblAllowMultiplesL3 = new JLabel("Allow Multiples?"); checkAllowMultiplesL3 = new JCheckBox(""); checkAllowMultiplesL3.setName("AllowMultiplesL3"); JLabel lblDescriptionL4 = new JLabel("Layer 4"); lblDescriptionL4.setFont(new Font("Tahoma", Font.PLAIN, 11)); JLabel lblDescription_3 = new JLabel("Description"); textfldDescriptionL4 = new JTextField(); textfldDescriptionL4.setName("DescriptionL4"); textfldDescriptionL4.setColumns(10); lblFilePrefixL4 = new JLabel("File Prefix/Suffix"); textfldFilePrefixL4 = new JTextField(); textfldFilePrefixL4.setName("FilePrefixL4"); textfldFilePrefixL4.setColumns(10); lblAllowMultiplesL4 = new JLabel("Allow Multiples?"); checkAllowMultiplesL4 = new JCheckBox(""); checkAllowMultiplesL4.setName("AllowMultiplesL4"); GroupLayout gl_panel_ExtraLayers = new GroupLayout(panel_ExtraLayers); gl_panel_ExtraLayers .setHorizontalGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_ExtraLayers.createSequentialGroup().addContainerGap() .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.LEADING) .addComponent(lblDescriptionL2) .addGroup(gl_panel_ExtraLayers.createSequentialGroup() .addComponent(lblDescription_1).addGap(44) .addComponent(textfldDescriptionL2, GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE)) .addGroup(gl_panel_ExtraLayers.createSequentialGroup() .addComponent(lblFilePrefixL2).addGap(18) .addComponent(textfldFilePrefixL2, GroupLayout.PREFERRED_SIZE, 53, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panel_ExtraLayers.createSequentialGroup() .addComponent(lblAllowMultiplesL2).addGap(18) .addComponent(checkAllowMultiplesL2)) .addComponent(lblDescriptionL3) .addGroup(gl_panel_ExtraLayers.createSequentialGroup() .addGroup(gl_panel_ExtraLayers .createParallelGroup(Alignment.LEADING) .addComponent(lblDescription_2) .addComponent(lblFilePrefixL3) .addComponent(lblAllowMultiplesL3)) .addGroup(gl_panel_ExtraLayers .createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_ExtraLayers.createSequentialGroup() .addGap(21) .addGroup(gl_panel_ExtraLayers .createParallelGroup(Alignment.LEADING) .addComponent(textfldFilePrefixL3, GroupLayout.PREFERRED_SIZE, 50, GroupLayout.PREFERRED_SIZE) .addComponent( textfldDescriptionL3, GroupLayout.DEFAULT_SIZE, 190, Short.MAX_VALUE))) .addGroup(gl_panel_ExtraLayers.createSequentialGroup() .addGap(18) .addGroup(gl_panel_ExtraLayers .createParallelGroup(Alignment.LEADING) .addComponent(textfldDescriptionL4, GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE) .addGroup(gl_panel_ExtraLayers .createSequentialGroup() .addComponent(checkAllowMultiplesL3) .addPreferredGap( ComponentPlacement.RELATED, 172, Short.MAX_VALUE)))))) .addComponent(lblDescriptionL4).addComponent(lblDescription_3) .addGroup(gl_panel_ExtraLayers.createSequentialGroup() .addComponent(lblFilePrefixL4).addGap(18) .addComponent(textfldFilePrefixL4, GroupLayout.PREFERRED_SIZE, 54, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panel_ExtraLayers.createSequentialGroup() .addComponent(lblAllowMultiplesL4).addGap(18) .addComponent(checkAllowMultiplesL4))) .addContainerGap())); gl_panel_ExtraLayers.setVerticalGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_ExtraLayers.createSequentialGroup().addContainerGap() .addComponent(lblDescriptionL2).addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.BASELINE) .addComponent(lblDescription_1) .addComponent(textfldDescriptionL2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.BASELINE) .addComponent(lblFilePrefixL2) .addComponent(textfldFilePrefixL2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.BASELINE) .addComponent(lblAllowMultiplesL2).addComponent(checkAllowMultiplesL2)) .addGap(18).addComponent(lblDescriptionL3).addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.BASELINE) .addComponent(lblDescription_2) .addComponent(textfldDescriptionL3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.BASELINE) .addComponent(lblFilePrefixL3) .addComponent(textfldFilePrefixL3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.LEADING) .addComponent(lblAllowMultiplesL3).addComponent(checkAllowMultiplesL3)) .addGap(18).addComponent(lblDescriptionL4).addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.BASELINE) .addComponent(lblDescription_3) .addComponent(textfldDescriptionL4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.BASELINE) .addComponent(lblFilePrefixL4) .addComponent(textfldFilePrefixL4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.BASELINE) .addComponent(lblAllowMultiplesL4).addComponent(checkAllowMultiplesL4)) .addContainerGap(39, Short.MAX_VALUE))); panel_ExtraLayers.setLayout(gl_panel_ExtraLayers); lblDescription = new JLabel(); lblDescription.setText("Description"); textfldDescription = new JTextField(); textfldDescription.setName("Description"); textfldFilePrefix = new JTextField(); textfldFilePrefix.setName("FilePrefix"); lblFilePrefix = new JLabel(); lblFilePrefix.setText("File Prefix/Suffix"); lblPosition = new JLabel(); lblPosition.setText("Position"); cmbPosition = new JComboBox(); cmbPosition.setName("Position"); lblMandatory = new JLabel(); lblMandatory.setText("Mandatory?"); checkMandatory = new JCheckBox(); checkMandatory.setName("Mandatory"); lblAllowMultiples = new JLabel(); lblAllowMultiples.setText("Allow Multiples?"); checkAllowMultiples = new JCheckBox(); checkAllowMultiples.setName("AllowMultiples"); lblExtraLayers = new JLabel("Extra Layers?"); checkExtraLayers = new JCheckBox(""); checkExtraLayers.setName("ExtraLayers"); checkExtraLayers.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { JCheckBox button = (JCheckBox) e.getSource(); if (button.isSelected()) { panel_MainDesc.setVisible(true); panel_ExtraLayers.setVisible(true); pnlDetails.revalidate(); pnlDetails.repaint(); } else { panel_MainDesc.setVisible(false); panel_ExtraLayers.setVisible(false); pnlDetails.revalidate(); pnlDetails.repaint(); } } }); GroupLayout gl_panelLayer1 = new GroupLayout(panelLayer1); gl_panelLayer1.setHorizontalGroup(gl_panelLayer1.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelLayer1.createSequentialGroup().addContainerGap() .addGroup(gl_panelLayer1.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelLayer1.createSequentialGroup() .addGroup(gl_panelLayer1.createParallelGroup(Alignment.LEADING) .addComponent(lblFilePrefix).addComponent(lblDescription) .addComponent(lblPosition)) .addGap(18) .addGroup(gl_panelLayer1.createParallelGroup(Alignment.LEADING) .addComponent(textfldFilePrefix, GroupLayout.PREFERRED_SIZE, 51, GroupLayout.PREFERRED_SIZE) .addComponent(textfldDescription, GroupLayout.DEFAULT_SIZE, 169, Short.MAX_VALUE) .addComponent(cmbPosition, 0, 169, Short.MAX_VALUE))) .addGroup( gl_panelLayer1.createSequentialGroup() .addGroup(gl_panelLayer1.createParallelGroup(Alignment.LEADING) .addComponent(lblAllowMultiples) .addComponent(lblExtraLayers).addComponent(lblMandatory)) .addGap(18) .addGroup(gl_panelLayer1.createParallelGroup(Alignment.LEADING) .addComponent(checkExtraLayers).addComponent(checkMandatory) .addComponent(checkAllowMultiples)))) .addContainerGap())); gl_panelLayer1 .setVerticalGroup(gl_panelLayer1.createParallelGroup(Alignment.TRAILING).addGroup(Alignment.LEADING, gl_panelLayer1.createSequentialGroup().addGap(24) .addGroup(gl_panelLayer1.createParallelGroup(Alignment.BASELINE) .addComponent(lblDescription) .addComponent(textfldDescription, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelLayer1 .createParallelGroup(Alignment.BASELINE).addComponent(lblFilePrefix) .addComponent(textfldFilePrefix, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelLayer1.createParallelGroup(Alignment.BASELINE) .addComponent(lblPosition) .addComponent(cmbPosition, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(8) .addGroup(gl_panelLayer1.createParallelGroup(Alignment.LEADING) .addComponent(checkMandatory).addComponent(lblMandatory)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelLayer1.createParallelGroup(Alignment.LEADING) .addComponent(checkAllowMultiples).addComponent(lblAllowMultiples)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelLayer1.createParallelGroup(Alignment.BASELINE) .addComponent(lblExtraLayers).addComponent(checkExtraLayers)) .addContainerGap(26, Short.MAX_VALUE))); panelLayer1.setLayout(gl_panelLayer1); btnMoveUp.setPreferredSize(new java.awt.Dimension(91, 23)); btnMoveUp.setText("Move Up"); btnMoveDown.setText("Move Down"); btnAddNew.setText("Add New"); btnDelete.setText("Delete"); btnSave.setText("Save"); btnCancel.setText("Cancel"); btnClose.setText("Close"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout .createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(Alignment.TRAILING).addGroup(layout.createSequentialGroup() .addComponent(scrlDescription, GroupLayout.DEFAULT_SIZE, 172, Short.MAX_VALUE).addGap(18) .addGroup(layout.createParallelGroup(Alignment.TRAILING) .addGroup(layout.createSequentialGroup().addComponent(btnAddNew).addGap(18) .addComponent(btnDelete, GroupLayout.PREFERRED_SIZE, 75, GroupLayout.PREFERRED_SIZE) .addGap(19)) .addComponent(pnlDetails, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createSequentialGroup() .addComponent(btnMoveUp, GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(btnMoveDown, GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE).addGap(89) .addComponent(btnSave, GroupLayout.DEFAULT_SIZE, 61, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(btnCancel, GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(btnClose, GroupLayout.DEFAULT_SIZE, 62, Short.MAX_VALUE))) .addContainerGap())); layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout .createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup() .addComponent(pnlDetails, GroupLayout.PREFERRED_SIZE, 597, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(btnDelete) .addComponent(btnAddNew))) .addComponent(scrlDescription, GroupLayout.DEFAULT_SIZE, 387, Short.MAX_VALUE)) .addGap(18) .addGroup(layout.createParallelGroup(Alignment.LEADING) .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(btnMoveUp, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(btnMoveDown)) .addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(btnClose) .addComponent(btnCancel).addComponent(btnSave))) .addContainerGap())); pnlDetails.setLayout(new BoxLayout(pnlDetails, BoxLayout.Y_AXIS)); panel_MainDesc = new JPanel(); panel_MainDesc.setMinimumSize(new Dimension(300, 0)); panel_MainDesc.setPreferredSize(new Dimension(300, 60)); panel_MainDesc.setMaximumSize(new Dimension(300, 60)); panel_MainDesc.setVisible(false); lblDescriptionMain = new JLabel("Main Description"); textfldDescriptionMain = new JTextField(); textfldDescriptionMain.setName("DescriptionMain"); textfldDescriptionMain.setColumns(10); btnGenMainDesc_1 = new JButton(""); btnGenMainDesc_1.setToolTipText("Generate a main description by concatenating layer descriptions."); btnGenMainDesc_1.setContentAreaFilled(false); btnGenMainDesc_1.setIcon(new ImageIcon(StructMapFileDescManagement.class .getResource("/org/jdesktop/swingx/plaf/basic/resources/month-down.png"))); GroupLayout gl_panel_MainDesc = new GroupLayout(panel_MainDesc); gl_panel_MainDesc.setHorizontalGroup(gl_panel_MainDesc.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_MainDesc.createSequentialGroup().addContainerGap() .addComponent(lblDescriptionMain).addGap(18) .addComponent(textfldDescriptionMain, GroupLayout.PREFERRED_SIZE, 165, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(btnGenMainDesc_1, GroupLayout.PREFERRED_SIZE, 25, Short.MAX_VALUE) .addContainerGap())); gl_panel_MainDesc.setVerticalGroup(gl_panel_MainDesc.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_MainDesc.createSequentialGroup().addContainerGap().addGroup(gl_panel_MainDesc .createParallelGroup(Alignment.LEADING) .addComponent(btnGenMainDesc_1, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE) .addGroup(gl_panel_MainDesc.createParallelGroup(Alignment.BASELINE) .addComponent(lblDescriptionMain).addComponent(textfldDescriptionMain, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); panel_MainDesc.setLayout(gl_panel_MainDesc); pnlDetails.add(panel_MainDesc); pnlDetails.add(panelLayer1); pnlDetails.add(panel_ExtraLayers); getContentPane().setLayout(layout); pack(); }
From source file:au.org.ala.delta.intkey.ui.DefineButtonDialog.java
public DefineButtonDialog(Frame owner, boolean modal) { super(owner, modal); setPreferredSize(new Dimension(500, 430)); ResourceMap resourceMap = Application.getInstance().getContext().getResourceMap(DefineButtonDialog.class); resourceMap.injectFields(this); ActionMap actionMap = Application.getInstance().getContext().getActionMap(DefineButtonDialog.class, this); setTitle(title);/*from w ww .ja v a 2 s .c o m*/ _okButtonPressed = false; _pnlButtons = new JPanel(); getContentPane().add(_pnlButtons, BorderLayout.SOUTH); _btnOk = new JButton(); _btnOk.setAction(actionMap.get("DefineButtonDialog_OK")); _pnlButtons.add(_btnOk); _btnCancel = new JButton(); _btnCancel.setAction(actionMap.get("DefineButtonDialog_Cancel")); _pnlButtons.add(_btnCancel); _btnHelp = new JButton(); _btnHelp.setAction(actionMap.get("DefineButtonDialog_Help")); _btnHelp.setEnabled(false); _pnlButtons.add(_btnHelp); _pnlMain = new JPanel(); getContentPane().add(_pnlMain, BorderLayout.CENTER); _pnlMain.setLayout(new BorderLayout(5, 0)); _pnlButtonProperties = new JPanel(); _pnlButtonProperties.setBorder(new CompoundBorder(new EmptyBorder(5, 5, 5, 5), new CompoundBorder( new EtchedBorder(EtchedBorder.LOWERED, null, null), new EmptyBorder(5, 5, 5, 5)))); _pnlMain.add(_pnlButtonProperties, BorderLayout.NORTH); GridBagLayout gbl__pnlButtonProperties = new GridBagLayout(); gbl__pnlButtonProperties.columnWidths = new int[] { 475, 0 }; gbl__pnlButtonProperties.rowHeights = new int[] { 14, 23, 14, 20, 14, 20, 14, 0, 23, 23, 23, 23, 0 }; gbl__pnlButtonProperties.columnWeights = new double[] { 1.0, Double.MIN_VALUE }; gbl__pnlButtonProperties.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE }; _pnlButtonProperties.setLayout(gbl__pnlButtonProperties); _lblEnterNameOf = new JLabel(enterFileNameCaption); _lblEnterNameOf.setHorizontalAlignment(SwingConstants.LEFT); GridBagConstraints gbc__lblEnterNameOf = new GridBagConstraints(); gbc__lblEnterNameOf.anchor = GridBagConstraints.WEST; gbc__lblEnterNameOf.insets = new Insets(0, 0, 5, 0); gbc__lblEnterNameOf.gridx = 0; gbc__lblEnterNameOf.gridy = 0; _pnlButtonProperties.add(_lblEnterNameOf, gbc__lblEnterNameOf); _pnlFile = new JPanel(); GridBagConstraints gbc__pnlFile = new GridBagConstraints(); gbc__pnlFile.fill = GridBagConstraints.HORIZONTAL; gbc__pnlFile.insets = new Insets(0, 0, 5, 0); gbc__pnlFile.gridx = 0; gbc__pnlFile.gridy = 1; _pnlButtonProperties.add(_pnlFile, gbc__pnlFile); _pnlFile.setLayout(new BorderLayout(0, 0)); _txtFldFileName = new JTextField(); _pnlFile.add(_txtFldFileName, BorderLayout.CENTER); _txtFldFileName.setColumns(10); _btnBrowse = new JButton(); _btnBrowse.setAction(actionMap.get("DefineButtonDialog_Browse")); _pnlFile.add(_btnBrowse, BorderLayout.EAST); _lblEnterTheCommands = new JLabel(enterCommandsCaption); _lblEnterTheCommands.setHorizontalAlignment(SwingConstants.LEFT); GridBagConstraints gbc__lblEnterTheCommands = new GridBagConstraints(); gbc__lblEnterTheCommands.anchor = GridBagConstraints.WEST; gbc__lblEnterTheCommands.insets = new Insets(0, 0, 5, 0); gbc__lblEnterTheCommands.gridx = 0; gbc__lblEnterTheCommands.gridy = 2; _pnlButtonProperties.add(_lblEnterTheCommands, gbc__lblEnterTheCommands); _txtFldCommands = new JTextField(); GridBagConstraints gbc__txtFldCommands = new GridBagConstraints(); gbc__txtFldCommands.fill = GridBagConstraints.HORIZONTAL; gbc__txtFldCommands.insets = new Insets(0, 0, 5, 0); gbc__txtFldCommands.gridx = 0; gbc__txtFldCommands.gridy = 3; _pnlButtonProperties.add(_txtFldCommands, gbc__txtFldCommands); _txtFldCommands.setColumns(10); _lblEnterBriefHelp = new JLabel(enterBriefHelpCaption); _lblEnterBriefHelp.setAlignmentY(Component.TOP_ALIGNMENT); GridBagConstraints gbc__lblEnterBriefHelp = new GridBagConstraints(); gbc__lblEnterBriefHelp.anchor = GridBagConstraints.NORTHWEST; gbc__lblEnterBriefHelp.insets = new Insets(0, 0, 5, 0); gbc__lblEnterBriefHelp.gridx = 0; gbc__lblEnterBriefHelp.gridy = 4; _pnlButtonProperties.add(_lblEnterBriefHelp, gbc__lblEnterBriefHelp); _txtFldBriefHelp = new JTextField(); GridBagConstraints gbc__txtFldBriefHelp = new GridBagConstraints(); gbc__txtFldBriefHelp.fill = GridBagConstraints.HORIZONTAL; gbc__txtFldBriefHelp.insets = new Insets(0, 0, 5, 0); gbc__txtFldBriefHelp.gridx = 0; gbc__txtFldBriefHelp.gridy = 5; _pnlButtonProperties.add(_txtFldBriefHelp, gbc__txtFldBriefHelp); _txtFldBriefHelp.setColumns(10); _lblEnterMoreDetailed = new JLabel(enterDetailedHelpCaption); GridBagConstraints gbc__lblEnterMoreDetailed = new GridBagConstraints(); gbc__lblEnterMoreDetailed.anchor = GridBagConstraints.WEST; gbc__lblEnterMoreDetailed.insets = new Insets(0, 0, 5, 0); gbc__lblEnterMoreDetailed.gridx = 0; gbc__lblEnterMoreDetailed.gridy = 6; _pnlButtonProperties.add(_lblEnterMoreDetailed, gbc__lblEnterMoreDetailed); _txtFldDetailedHelp = new JTextField(); GridBagConstraints gbc__txtFldDetailedHelp = new GridBagConstraints(); gbc__txtFldDetailedHelp.insets = new Insets(0, 0, 5, 0); gbc__txtFldDetailedHelp.fill = GridBagConstraints.HORIZONTAL; gbc__txtFldDetailedHelp.gridx = 0; gbc__txtFldDetailedHelp.gridy = 7; _pnlButtonProperties.add(_txtFldDetailedHelp, gbc__txtFldDetailedHelp); _txtFldDetailedHelp.setColumns(10); _chckbxEnableOnlyIfUsedCharacters = new JCheckBox(enableOnlyIfUsedCaption); GridBagConstraints gbc__chckbxEnableOnlyIf = new GridBagConstraints(); gbc__chckbxEnableOnlyIf.anchor = GridBagConstraints.WEST; gbc__chckbxEnableOnlyIf.insets = new Insets(0, 0, 5, 0); gbc__chckbxEnableOnlyIf.gridx = 0; gbc__chckbxEnableOnlyIf.gridy = 8; _pnlButtonProperties.add(_chckbxEnableOnlyIfUsedCharacters, gbc__chckbxEnableOnlyIf); _rdbtnEnableInAll = new JRadioButton(enableInAllModesCaption); GridBagConstraints gbc__rdbtnEnableInAll = new GridBagConstraints(); gbc__rdbtnEnableInAll.anchor = GridBagConstraints.WEST; gbc__rdbtnEnableInAll.insets = new Insets(0, 0, 5, 0); gbc__rdbtnEnableInAll.gridx = 0; gbc__rdbtnEnableInAll.gridy = 9; _pnlButtonProperties.add(_rdbtnEnableInAll, gbc__rdbtnEnableInAll); _rdbtnEnableInNormal = new JRadioButton(enableInNormalModeCaption); GridBagConstraints gbc__rdbtnEnableInNormal = new GridBagConstraints(); gbc__rdbtnEnableInNormal.anchor = GridBagConstraints.WEST; gbc__rdbtnEnableInNormal.insets = new Insets(0, 0, 5, 0); gbc__rdbtnEnableInNormal.gridx = 0; gbc__rdbtnEnableInNormal.gridy = 10; _pnlButtonProperties.add(_rdbtnEnableInNormal, gbc__rdbtnEnableInNormal); _rdbtnEnableInAdvanced = new JRadioButton(enableInAdvancedModeCaption); GridBagConstraints gbc__rdbtnEnableInAdvanced = new GridBagConstraints(); gbc__rdbtnEnableInAdvanced.anchor = GridBagConstraints.WEST; gbc__rdbtnEnableInAdvanced.gridx = 0; gbc__rdbtnEnableInAdvanced.gridy = 11; _pnlButtonProperties.add(_rdbtnEnableInAdvanced, gbc__rdbtnEnableInAdvanced); _pnlSpaceRemoveAll = new JPanel(); _pnlSpaceRemoveAll.setBorder(new EmptyBorder(0, 10, 0, 0)); _pnlMain.add(_pnlSpaceRemoveAll, BorderLayout.SOUTH); _pnlSpaceRemoveAll.setLayout(new BoxLayout(_pnlSpaceRemoveAll, BoxLayout.Y_AXIS)); _chckbxInsertASpace = new JCheckBox(insertSpaceCaption); _chckbxInsertASpace.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { _insertSpace = !_insertSpace; if (_insertSpace) { _removeAllButtons = false; _chckbxRemoveAllButtons.setSelected(false); } updateButtonPropertyControls(); } }); _pnlSpaceRemoveAll.add(_chckbxInsertASpace); _chckbxRemoveAllButtons = new JCheckBox(removeAllCaption); _chckbxRemoveAllButtons.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { _removeAllButtons = !_removeAllButtons; if (_removeAllButtons) { _insertSpace = false; _chckbxInsertASpace.setSelected(false); } updateButtonPropertyControls(); } }); _pnlSpaceRemoveAll.add(_chckbxRemoveAllButtons); _pnlButtonProperties.setEnabled(false); ButtonGroup btnGroup = new ButtonGroup(); btnGroup.add(_rdbtnEnableInAll); btnGroup.add(_rdbtnEnableInNormal); btnGroup.add(_rdbtnEnableInAdvanced); _rdbtnEnableInAll.setSelected(true); }