List of usage examples for com.jgoodies.forms.layout FormLayout FormLayout
public FormLayout(ColumnSpec[] colSpecs, RowSpec[] rowSpecs)
From source file:Door.java
public void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - Hamza GUPUR label1 = new JLabel(); button3 = new JButton(); //======== frame1 ======== {/* w w w. jav a2s . c om*/ setMinimumSize(new Dimension(1300, 500)); TcontentPane.setLayout(new FormLayout( "19dlu, 3*($lcgap, default), $lcgap, 138dlu, 4*($lcgap, default), $lcgap, 41dlu, 3*($lcgap, default), $lcgap, 46dlu, 3*($lcgap, default), $lcgap, 80dlu, $lcgap, 9dlu, $lcgap, 84dlu, 4*($lcgap, default)", "default, $lgap, 22dlu, 3*($lgap, default), $lgap, 57dlu, 9*($lgap, default), $lgap, 70dlu")); //---- label1 ---- label1.setText(satus + " --- " + value); TcontentPane.add(label1, CC.xywh(3, 5, 44, 1)); exp = false; //---- button3 ---- button3.setText("Close Windows"); TcontentPane.add(button3, CC.xy(39, 11)); button3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { dispose(); // in order to close previous frame } }); } }
From source file:NewJFormDesignerForm.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - unknown //======== this ======== // JFormDesigner evaluation mark setBorder(// www. j a v a 2 s . co m new javax.swing.border.CompoundBorder( new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0), "JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Dialog", java.awt.Font.BOLD, 12), java.awt.Color.red), getBorder())); addPropertyChangeListener(new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent e) { if ("border".equals(e.getPropertyName())) throw new RuntimeException(); } }); setLayout(new FormLayout("default, $lcgap, default", "2*(default, $lgap), default")); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:AddAccountView.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner non-commercial license panel1 = new JPanel(); panel2 = new JPanel(); label1 = new JLabel(); usernameText = new JTextField(); label2 = new JLabel(); passwordText = new JTextField(); label3 = new JLabel(); zipText = new JTextField(); label4 = new JLabel(); proxyText = new JTextField(); label5 = new JLabel(); portText = new JTextField(); label6 = new JLabel(); proxyUsernameText = new JTextField(); label7 = new JLabel(); proxyPasswordText = new JTextField(); buttonPanel = new JPanel(); closeButton = new JButton(); addButton = new JButton(); //======== this ======== setTitle("Add Account"); Container contentPane = getContentPane(); contentPane.setLayout(new FormLayout("default", "default:grow")); //======== panel1 ======== {/*from www .j a v a 2s .com*/ panel1.setPreferredSize(new Dimension(250, 300)); panel1.setLayout(new FormLayout("default:grow", "default, $lgap, default")); //======== panel2 ======== { panel2.setFont(new Font("Lucida Grande", Font.PLAIN, 10)); panel2.setLayout(new FormLayout("default, $lcgap, 68dlu", "6*(default, $lgap), default")); //---- label1 ---- label1.setText("Username:"); label1.setFont(new Font("Lucida Grande", Font.PLAIN, 10)); panel2.add(label1, CC.xy(1, 1, CC.RIGHT, CC.DEFAULT)); //---- usernameText ---- usernameText.setFont(new Font("Lucida Grande", Font.PLAIN, 10)); usernameText.setName("username"); panel2.add(usernameText, CC.xy(3, 1)); //---- label2 ---- label2.setText("Password:"); label2.setFont(new Font("Lucida Grande", Font.PLAIN, 10)); panel2.add(label2, CC.xy(1, 3, CC.RIGHT, CC.DEFAULT)); //---- passwordText ---- passwordText.setFont(new Font("Lucida Grande", Font.PLAIN, 10)); passwordText.setName("password"); panel2.add(passwordText, CC.xy(3, 3)); //---- label3 ---- label3.setText("Zip:"); label3.setFont(new Font("Lucida Grande", Font.PLAIN, 10)); panel2.add(label3, CC.xy(1, 5, CC.RIGHT, CC.DEFAULT)); //---- zipText ---- zipText.setFont(new Font("Lucida Grande", Font.PLAIN, 10)); zipText.setName("zip"); panel2.add(zipText, CC.xy(3, 5)); //---- label4 ---- label4.setText("Proxy:"); label4.setFont(new Font("Lucida Grande", Font.PLAIN, 10)); panel2.add(label4, CC.xy(1, 7, CC.RIGHT, CC.DEFAULT)); //---- proxyText ---- proxyText.setFont(new Font("Lucida Grande", Font.PLAIN, 10)); proxyText.setName("proxy"); panel2.add(proxyText, CC.xy(3, 7)); //---- label5 ---- label5.setText("Port:"); label5.setFont(new Font("Lucida Grande", Font.PLAIN, 10)); panel2.add(label5, CC.xy(1, 9, CC.RIGHT, CC.DEFAULT)); //---- portText ---- portText.setFont(new Font("Lucida Grande", Font.PLAIN, 10)); portText.setName("port"); panel2.add(portText, CC.xy(3, 9)); //---- label6 ---- label6.setText("Proxy username:"); label6.setFont(new Font("Lucida Grande", Font.PLAIN, 10)); panel2.add(label6, CC.xy(1, 11, CC.RIGHT, CC.DEFAULT)); //---- proxyUsernameText ---- proxyUsernameText.setFont(new Font("Lucida Grande", Font.PLAIN, 10)); proxyUsernameText.setName("proxyUsername"); panel2.add(proxyUsernameText, CC.xy(3, 11)); //---- label7 ---- label7.setText("Proxy password:"); label7.setFont(new Font("Lucida Grande", Font.PLAIN, 10)); panel2.add(label7, CC.xy(1, 13, CC.RIGHT, CC.DEFAULT)); //---- proxyPasswordText ---- proxyPasswordText.setFont(new Font("Lucida Grande", Font.PLAIN, 10)); proxyPasswordText.setName("proxyPassword"); panel2.add(proxyPasswordText, CC.xy(3, 13)); } panel1.add(panel2, CC.xy(1, 1, CC.DEFAULT, CC.TOP)); //======== buttonPanel ======== { buttonPanel.setLayout(new FormLayout("default, $lcgap, default", "default")); //---- closeButton ---- closeButton.setText("Close"); closeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { closeButtonActionPerformed(e); } }); buttonPanel.add(closeButton, CC.xy(1, 1, CC.CENTER, CC.DEFAULT)); //---- addButton ---- addButton.setText("Add"); addButton.setEnabled(false); addButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { addButtonActionPerformed(e); } }); buttonPanel.add(addButton, CC.xy(3, 1)); } panel1.add(buttonPanel, new CellConstraints(1, 3, 1, 1, CC.RIGHT, CC.DEFAULT, new Insets(0, 0, 0, 10))); } contentPane.add(panel1, new CellConstraints(1, 1, 1, 1, CC.DEFAULT, CC.DEFAULT, new Insets(10, 10, 0, 0))); pack(); setLocationRelativeTo(getOwner()); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:UserPreferencesDialog.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Open Source Project license - unknown ResourceBundle bundle = ResourceBundle.getBundle("UserPreferencesDialog"); JPanel dialogPane = new JPanel(); JPanel contentPanel = new JPanel(); toolbar = new JButtonBar(); panelCard = new JPanel(); JPanel panelGeneral = new JPanel(); JPanel panelGeneralSettings = new JPanel(); checkShowIconInSystemTray = new JCheckBox(); JPanel panelAlarm = new JPanel(); JPanel panelWhenAlarmGoesOff = new JPanel(); JPanel panelAlarmDefaults = new JPanel(); JPanel panelPlugins = new JPanel(); JTabbedPane pluginTabbedPane = new JTabbedPane(); JPanel pluginPanelSettings = new JPanel(); JScrollPane scrollPane1 = new JScrollPane(); pluginTable = new JXTable(); JXButtonPanel pluginsButtonPanel = new JXButtonPanel(); JLabel labelPluginInfo = new JLabel(); popmenuButton = ComponentFactory.getPopdownButton(); btnPluginOptions = new JButton(); JPanel pluginPanelUpdates = new JPanel(); check4PluginUpdatesAutomatically = new JCheckBox(); JLabel labelAfterDetectUpdate = new JLabel(); comboHowToUpdate = new JComboBox(); checkDownloadNotExistingPlugins = new JCheckBox(); JLabel labelCheckForUpdateEvery = new JLabel(); spinnerUpdateHour = new JSpinner(); JLabel labelHours = new JLabel(); JLabel labelUpdateFromServer = new JLabel(); comboPluginServers = new JComboBox(); btnResetDefaultPluginServer = new JButton(); JLabel labelManualCheck = new JLabel(); buttonBar = new JXButtonPanel(); btnOK = new JButton(); btnCancel = new JButton(); CellConstraints cc = new CellConstraints(); //======== this ======== setTitle(bundle.getString("this.title")); Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); //======== dialogPane ======== {/*from w w w .java 2 s. c o m*/ dialogPane.setLayout(new BorderLayout()); //======== contentPanel ======== { contentPanel.setLayout(new BorderLayout()); //======== toolbar ======== { toolbar.setBorder(LineBorder.createBlackLineBorder()); toolbar.setLayout(null); } contentPanel.add(toolbar, BorderLayout.NORTH); //======== panelCard ======== { panelCard.setLayout(new CardLayout()); //======== panelGeneral ======== { panelGeneral.setBorder(Borders.TABBED_DIALOG); //======== panelGeneralSettings ======== { panelGeneralSettings.setBorder( new TitledBorder(null, bundle.getString("panelGeneralSettings.border"), TitledBorder.LEADING, TitledBorder.TOP)); //---- checkShowIconInSystemTray ---- checkShowIconInSystemTray.setText(bundle.getString("checkShowIconInSystemTray.text")); PanelBuilder panelGeneralSettingsBuilder = new PanelBuilder(new FormLayout( new ColumnSpec[] { new ColumnSpec(ColumnSpec.LEFT, Sizes.dluX(0), FormSpec.NO_GROW), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC }, RowSpec.decodeSpecs("default")), panelGeneralSettings); panelGeneralSettingsBuilder.add(checkShowIconInSystemTray, cc.xy(3, 1)); } PanelBuilder panelGeneralBuilder = new PanelBuilder( new FormLayout(ColumnSpec.decodeSpecs("default:grow"), new RowSpec[] { new RowSpec(RowSpec.FILL, Sizes.DEFAULT, FormSpec.NO_GROW), FormSpecs.RELATED_GAP_ROWSPEC, new RowSpec(RowSpec.FILL, Sizes.DEFAULT, FormSpec.NO_GROW) }), panelGeneral); panelGeneralBuilder.add(panelGeneralSettings, cc.xy(1, 1)); } panelCard.add(panelGeneral, "CARD1"); //======== panelAlarm ======== { panelAlarm.setBorder(Borders.TABBED_DIALOG); //======== panelWhenAlarmGoesOff ======== { panelWhenAlarmGoesOff.setBorder( new TitledBorder(null, bundle.getString("panelWhenAlarmGoesOff.border"), TitledBorder.LEADING, TitledBorder.TOP)); PanelBuilder panelWhenAlarmGoesOffBuilder = new PanelBuilder( new FormLayout(new ColumnSpec[] { new ColumnSpec(ColumnSpec.LEFT, Sizes.dluX(0), FormSpec.NO_GROW), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC }, new RowSpec[] { FormSpecs.DEFAULT_ROWSPEC, FormSpecs.NARROW_LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC }), panelWhenAlarmGoesOff); ((FormLayout) panelWhenAlarmGoesOff.getLayout()) .setColumnGroups(new int[][] { { 9, 11 } }); } //======== panelAlarmDefaults ======== { panelAlarmDefaults .setBorder(new TitledBorder(null, bundle.getString("panelAlarmDefaults.border"), TitledBorder.LEADING, TitledBorder.TOP)); PanelBuilder panelAlarmDefaultsBuilder = new PanelBuilder(new FormLayout( new ColumnSpec[] { new ColumnSpec(ColumnSpec.LEFT, Sizes.dluX(0), FormSpec.NO_GROW), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC }, new RowSpec[] { FormSpecs.DEFAULT_ROWSPEC, FormSpecs.NARROW_LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.NARROW_LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.NARROW_LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC }), panelAlarmDefaults); } PanelBuilder panelAlarmBuilder = new PanelBuilder(new FormLayout( ColumnSpec.decodeSpecs("default:grow"), new RowSpec[] { FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC }), panelAlarm); panelAlarmBuilder.add(panelWhenAlarmGoesOff, cc.xy(1, 1)); panelAlarmBuilder.add(panelAlarmDefaults, cc.xy(1, 3)); } panelCard.add(panelAlarm, "CARD2"); //======== panelPlugins ======== { panelPlugins.setBorder(Borders.TABBED_DIALOG); //======== pluginTabbedPane ======== { //======== pluginPanelSettings ======== { pluginPanelSettings.setBorder( new CompoundBorder(new EmptyBorder(4, 4, 4, 4), new EtchedBorder())); pluginPanelSettings.setLayout(new BorderLayout()); //======== scrollPane1 ======== { scrollPane1.setViewportView(pluginTable); } pluginPanelSettings.add(scrollPane1, BorderLayout.CENTER); //======== pluginsButtonPanel ======== { pluginsButtonPanel.setBorder(new EmptyBorder(4, 4, 4, 4)); //---- labelPluginInfo ---- labelPluginInfo.setText(bundle.getString("labelPluginInfo.text")); //---- popmenuButton ---- popmenuButton.setText(bundle.getString("popmenuButton.text")); //---- btnPluginOptions ---- btnPluginOptions.setText(bundle.getString("btnPluginOptions.text")); PanelBuilder pluginsButtonPanelBuilder = new PanelBuilder(new FormLayout( new ColumnSpec[] { FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.UNRELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.UNRELATED_GAP_COLSPEC }, RowSpec.decodeSpecs("default")), pluginsButtonPanel); pluginsButtonPanelBuilder.add(labelPluginInfo, cc.xy(3, 1)); pluginsButtonPanelBuilder.add(popmenuButton, cc.xy(5, 1)); pluginsButtonPanelBuilder.add(btnPluginOptions, cc.xy(7, 1)); } pluginPanelSettings.add(pluginsButtonPanel, BorderLayout.SOUTH); } pluginTabbedPane.addTab(bundle.getString("pluginPanelSettings.tab.title"), pluginPanelSettings); //======== pluginPanelUpdates ======== { pluginPanelUpdates.setBorder(new CompoundBorder(new EmptyBorder(4, 4, 4, 4), new TitledBorder(bundle.getString("pluginPanelUpdates.border")))); //---- check4PluginUpdatesAutomatically ---- check4PluginUpdatesAutomatically .setText(bundle.getString("check4PluginUpdatesAutomatically.text")); //---- labelAfterDetectUpdate ---- labelAfterDetectUpdate.setText(bundle.getString("labelAfterDetectUpdate.text")); //---- checkDownloadNotExistingPlugins ---- checkDownloadNotExistingPlugins .setText(bundle.getString("checkDownloadNotExistingPlugins.text")); //---- labelCheckForUpdateEvery ---- labelCheckForUpdateEvery.setText(bundle.getString("labelCheckForUpdateEvery.text")); //---- labelHours ---- labelHours.setText(bundle.getString("labelHours.text")); //---- labelUpdateFromServer ---- labelUpdateFromServer.setText(bundle.getString("labelUpdateFromServer.text")); labelUpdateFromServer.setLabelFor(comboPluginServers); //---- comboPluginServers ---- comboPluginServers.setEditable(true); //---- btnResetDefaultPluginServer ---- btnResetDefaultPluginServer .setText(bundle.getString("btnResetDefaultPluginServer.text")); //---- labelManualCheck ---- labelManualCheck.setText(bundle.getString("labelManualCheck.text")); PanelBuilder pluginPanelUpdatesBuilder = new PanelBuilder(new FormLayout( new ColumnSpec[] { FormSpecs.DEFAULT_COLSPEC, FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes .bounded(Sizes.MINIMUM, Sizes.dluX(30), Sizes.dluX(30))), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.bounded(Sizes.DEFAULT, Sizes.dluX(50), Sizes.dluX(75)), FormSpec.DEFAULT_GROW), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.UNRELATED_GAP_COLSPEC }, new RowSpec[] { FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.UNRELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.UNRELATED_GAP_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC }), pluginPanelUpdates); pluginPanelUpdatesBuilder.add(check4PluginUpdatesAutomatically, cc.xywh(1, 1, 5, 1)); pluginPanelUpdatesBuilder.add(labelAfterDetectUpdate, cc.xywh(1, 3, 3, 1, CellConstraints.RIGHT, CellConstraints.DEFAULT)); pluginPanelUpdatesBuilder.add(comboHowToUpdate, cc.xywh(5, 3, 1, 1, CellConstraints.LEFT, CellConstraints.DEFAULT)); pluginPanelUpdatesBuilder.add(checkDownloadNotExistingPlugins, cc.xywh(1, 5, 5, 1)); pluginPanelUpdatesBuilder.add(labelCheckForUpdateEvery, cc.xywh(1, 7, 1, 1, CellConstraints.RIGHT, CellConstraints.DEFAULT)); pluginPanelUpdatesBuilder.add(spinnerUpdateHour, cc.xy(3, 7)); pluginPanelUpdatesBuilder.add(labelHours, cc.xy(5, 7)); pluginPanelUpdatesBuilder.add(labelUpdateFromServer, cc.xywh(1, 9, 1, 1, CellConstraints.RIGHT, CellConstraints.DEFAULT)); pluginPanelUpdatesBuilder.add(comboPluginServers, cc.xywh(3, 9, 3, 1)); pluginPanelUpdatesBuilder.add(btnResetDefaultPluginServer, cc.xy(7, 9)); pluginPanelUpdatesBuilder.add(labelManualCheck, cc.xywh(1, 13, 7, 1)); } pluginTabbedPane.addTab(bundle.getString("pluginPanelUpdates.tab.title"), pluginPanelUpdates); } PanelBuilder panelPluginsBuilder = new PanelBuilder( new FormLayout(ColumnSpec.decodeSpecs("default:grow"), new RowSpec[] { new RowSpec(RowSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("5px") }), panelPlugins); panelPluginsBuilder.add(pluginTabbedPane, cc.xy(1, 1)); } panelCard.add(panelPlugins, "CARD6"); } contentPanel.add(panelCard, BorderLayout.CENTER); } dialogPane.add(contentPanel, BorderLayout.CENTER); //======== buttonBar ======== { buttonBar.setBorder(Borders.BUTTON_BAR_PAD); buttonBar.setCyclic(true); //---- btnOK ---- btnOK.setText(bundle.getString("btnOK.text")); //---- btnCancel ---- btnCancel.setText(bundle.getString("btnCancel.text")); PanelBuilder buttonBarBuilder = new PanelBuilder(new FormLayout( new ColumnSpec[] { FormSpecs.GLUE_COLSPEC, ColumnSpec.decode("max(pref;42dlu)"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.PREF_COLSPEC }, RowSpec.decodeSpecs("pref")), buttonBar); ((FormLayout) buttonBar.getLayout()).setColumnGroups(new int[][] { { 2, 4 } }); buttonBarBuilder.add(btnOK, cc.xy(2, 1)); buttonBarBuilder.add(btnCancel, cc.xy(4, 1)); } dialogPane.add(buttonBar, BorderLayout.SOUTH); } contentPane.add(dialogPane, BorderLayout.CENTER); pack(); setLocationRelativeTo(getOwner()); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:ManageAccountsView.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner non-commercial license panel1 = new JPanel(); label1 = new JLabel(); usernameCombo = new JComboBox(); label2 = new JLabel(); passwordText = new JTextField(); label3 = new JLabel(); zipText = new JTextField(); label4 = new JLabel(); proxyText = new JTextField(); label5 = new JLabel(); portText = new JTextField(); label6 = new JLabel(); proxyUsernameText = new JTextField(); label7 = new JLabel(); proxyPasswordText = new JTextField(); buttonPanel = new JPanel(); addButton = new JButton(); deleteButton = new JButton(); closeButton = new JButton(); applyButton = new JButton(); //======== this ======== setTitle("Login Settings"); Container contentPane = getContentPane(); contentPane.setLayout(new FormLayout("136dlu", "top:138dlu, $lgap, default")); //======== panel1 ======== {// www.ja v a2 s. c o m panel1.setPreferredSize(new Dimension(200, 250)); panel1.setLayout(new FormLayout("default, $lcgap, 82dlu", "6*(default, $lgap), default")); //---- label1 ---- label1.setText("Username:"); label1.setFont(new Font("Lucida Grande", Font.PLAIN, 10)); panel1.add(label1, CC.xy(1, 1, CC.RIGHT, CC.DEFAULT)); //---- usernameCombo ---- usernameCombo.setFont(new Font("Lucida Grande", Font.PLAIN, 10)); usernameCombo.setPreferredSize(new Dimension(120, 27)); usernameCombo.setName("username"); usernameCombo.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { usernameComboItemStateChanged(e); } }); panel1.add(usernameCombo, CC.xy(3, 1)); //---- label2 ---- label2.setText("Password:"); label2.setFont(new Font("Lucida Grande", Font.PLAIN, 10)); panel1.add(label2, CC.xy(1, 3, CC.RIGHT, CC.DEFAULT)); //---- passwordText ---- passwordText.setFont(new Font("Lucida Grande", Font.PLAIN, 10)); passwordText.setPreferredSize(new Dimension(120, 25)); passwordText.setName("password"); passwordText.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { passwordTextKeyReleased(e); } }); panel1.add(passwordText, CC.xy(3, 3)); //---- label3 ---- label3.setText("Zip:"); label3.setFont(new Font("Lucida Grande", Font.PLAIN, 10)); panel1.add(label3, CC.xy(1, 5, CC.RIGHT, CC.DEFAULT)); //---- zipText ---- zipText.setFont(new Font("Lucida Grande", Font.PLAIN, 10)); zipText.setPreferredSize(new Dimension(120, 25)); zipText.setName("zip"); zipText.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { zipTextKeyReleased(e); } }); panel1.add(zipText, CC.xy(3, 5)); //---- label4 ---- label4.setText("Proxy:"); label4.setFont(new Font("Lucida Grande", Font.PLAIN, 10)); panel1.add(label4, CC.xy(1, 7, CC.RIGHT, CC.DEFAULT)); //---- proxyText ---- proxyText.setFont(new Font("Lucida Grande", Font.PLAIN, 10)); proxyText.setPreferredSize(new Dimension(120, 25)); proxyText.setName("proxy"); proxyText.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { proxyTextKeyReleased(e); } }); panel1.add(proxyText, CC.xy(3, 7)); //---- label5 ---- label5.setText("Port:"); label5.setFont(new Font("Lucida Grande", Font.PLAIN, 10)); panel1.add(label5, CC.xy(1, 9, CC.RIGHT, CC.DEFAULT)); //---- portText ---- portText.setFont(new Font("Lucida Grande", Font.PLAIN, 10)); portText.setPreferredSize(new Dimension(120, 25)); portText.setName("port"); portText.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { portTextKeyReleased(e); } }); panel1.add(portText, CC.xy(3, 9)); //---- label6 ---- label6.setText("Proxy username:"); label6.setFont(new Font("Lucida Grande", Font.PLAIN, 10)); panel1.add(label6, CC.xy(1, 11, CC.RIGHT, CC.DEFAULT)); //---- proxyUsernameText ---- proxyUsernameText.setFont(new Font("Lucida Grande", Font.PLAIN, 10)); proxyUsernameText.setPreferredSize(new Dimension(120, 25)); proxyUsernameText.setName("proxyUsername"); proxyUsernameText.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { proxyUsernameTextKeyReleased(e); } }); panel1.add(proxyUsernameText, CC.xy(3, 11)); //---- label7 ---- label7.setText("Proxy Password:"); label7.setFont(new Font("Lucida Grande", Font.PLAIN, 10)); panel1.add(label7, CC.xy(1, 13, CC.RIGHT, CC.DEFAULT)); //---- proxyPasswordText ---- proxyPasswordText.setPreferredSize(new Dimension(120, 25)); proxyPasswordText.setFont(new Font("Lucida Grande", Font.PLAIN, 10)); proxyPasswordText.setName("proxyPassword"); proxyPasswordText.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { proxyPasswordTextKeyReleased(e); } }); panel1.add(proxyPasswordText, CC.xy(3, 13)); } contentPane.add(panel1, new CellConstraints(1, 1, 1, 1, CC.DEFAULT, CC.TOP, new Insets(10, 10, 0, 0))); //======== buttonPanel ======== { buttonPanel.setLayout(new FormLayout("default, $lcgap, default", "2*(default)")); //---- addButton ---- addButton.setText("Add"); addButton.setFont(new Font("Lucida Grande", Font.PLAIN, 12)); addButton.setName("addButton"); addButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { addButtonActionPerformed(e); } }); buttonPanel.add(addButton, CC.xy(1, 1)); //---- deleteButton ---- deleteButton.setText("Delete"); deleteButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { deleteButtonActionPerformed(e); } }); buttonPanel.add(deleteButton, CC.xy(3, 1)); //---- closeButton ---- closeButton.setText("Close"); closeButton.setFont(new Font("Lucida Grande", Font.PLAIN, 12)); closeButton.setPreferredSize(new Dimension(86, 29)); closeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { closeButtonActionPerformed(e); } }); buttonPanel.add(closeButton, CC.xy(1, 2, CC.LEFT, CC.DEFAULT)); //---- applyButton ---- applyButton.setText("Apply"); applyButton.setFont(new Font("Lucida Grande", Font.PLAIN, 12)); applyButton.setPreferredSize(new Dimension(86, 29)); applyButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { applyButtonActionPerformed(e); } }); buttonPanel.add(applyButton, CC.xy(3, 2, CC.LEFT, CC.DEFAULT)); } contentPane.add(buttonPanel, CC.xy(1, 3, CC.RIGHT, CC.TOP)); pack(); setLocationRelativeTo(getOwner()); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:aconsole.config.PropertyPanel.java
License:Open Source License
public PropertyPanel() { CellConstraints cc = new CellConstraints(); FormLayout layout = new FormLayout("5dlu, pref, pref,default:grow", "pref, 5dlu"); PanelBuilder panelBuilder = new PanelBuilder(layout); panelBuilder.add(new JLabel(mLocalizer.msg("title", "setup appearance of TVBConsole")), cc.xyw(2, 1, 2)); int row = 2;//from w w w .j a v a2s . c o m row += addColorButton(AConsole.getBg(), mLocalizer.msg("Bg.label", "background:"), mLocalizer.msg("Bg.tooltip", "select the color for the console background"), layout, panelBuilder, cc, row); row += addColorButton(AConsole.getSelection(), mLocalizer.msg("Selection.label", "background for selected rows:"), mLocalizer.msg("Selection.tooltip", ""), layout, panelBuilder, cc, row); row += addColorButton(AConsole.getSelectionText(), mLocalizer.msg("SelectionText.label", "color for selected text:"), mLocalizer.msg("SelectionText.tooltip", ""), layout, panelBuilder, cc, row); row += addColorButton(AConsole.getSystemOutText(), mLocalizer.msg("SystemOutText.label", "color for text send to System.out:"), mLocalizer.msg("SystemOutText.tooltip", ""), layout, panelBuilder, cc, row); row += addColorButton(AConsole.getSystemErrText(), mLocalizer.msg("SystemErrText.label", "color for text send to System.err:"), mLocalizer.msg("SystemErrText.tooltip", ""), layout, panelBuilder, cc, row); row += addColorButton(AConsole.getLevelSevereText(), mLocalizer.msg("LevelSevereText.label", "text with logger-level of severe or higher:"), mLocalizer.msg("LevelSevereText.tooltip", ""), layout, panelBuilder, cc, row); row += addColorButton(AConsole.getLevelWarningText(), mLocalizer.msg("LevelWarningText.label", "text with logger-level between warning and severe:"), mLocalizer.msg("LevelWarningText.tooltip", ""), layout, panelBuilder, cc, row); row += addColorButton(AConsole.getLevelInfoText(), mLocalizer.msg("LevelInfoText.label", "text with logger-level between info and warning:"), mLocalizer.msg("LevelInfoText.tooltip", ""), layout, panelBuilder, cc, row); row += addColorButton(AConsole.getLevelOtherText(), mLocalizer.msg("LevelOtherText.label", "text with logger-level less than warning:"), mLocalizer.msg("LevelOtherText.tooltip", ""), layout, panelBuilder, cc, row); panel = panelBuilder.getPanel(); }
From source file:action.About.java
License:Open Source License
private JPanel getaboutPanel() { FormLayout lay = new FormLayout("left:pref, 3dlu, left:pref, max(200dlu;pref)", "p, p, 10dlu, p, 3dlu, p, 10dlu, p, 10dlu, p, p");// rows CellConstraints cc = new CellConstraints(); PanelBuilder build = new PanelBuilder(lay); ImageIcon ii = TResourceUtils.getIcon("appIcon", 80); JLabel jl = new JLabel(ii); jl.setHorizontalAlignment(JLabel.LEFT); build.add(jl, cc.xyw(1, 1, 4));//from w ww. ja v a2 s . com build.add(new JLabel(TStringUtils.getBundleString("about.app")), cc.xyw(1, 2, 4)); build.add(new JLabel(TStringUtils.getBundleString("about.version")), cc.xy(1, 4)); build.add(new JLabel(SystemVariables.getStringVar("versionID")), cc.xy(3, 4)); build.add(new JLabel(TStringUtils.getBundleString("about.update")), cc.xy(1, 6)); build.add(new JLabel(SystemVariables.getStringVar("updateID")), cc.xy(3, 6)); build.add(new JLabel(TStringUtils.getBundleString("about.msg1")), cc.xyw(1, 8, 4)); build.add(new JLabel(TStringUtils.getBundleString("about.msg2")), cc.xyw(1, 10, 4)); build.add(getOpenSourcePanel(), cc.xyw(1, 11, 4)); // build.add(Box.createVerticalStrut(4), cc.xy(1, 7)); JPanel jp = build.getPanel(); jp.setBorder(new EmptyBorder(4, 4, 4, 4)); return jp; }
From source file:ai.aitia.meme.utils.FormsUtils.java
License:Open Source License
/** * Returns a DefaultFormBuilder containing the specified components and layout. * @param cols This parameter corresponds to the <code>encodedColumnSpecs</code> * parameter of FormLayout's ctor. Besides the encoding defined by FormLayout, * the following extensions are also available: the characters defined in the * global <code>{@link #gapLength}</code> variable (hereafter: gap-characters) * can be used to insert gap-columns. Gap columns must not appear in the * cell-specification (explained below) and they're automatically included in * column spans. //from ww w . j a va2 s. c o m * Consecutive gap-characters are coalesced into 1 gap column by calculating * their cumulated pixel size. * @param rows A string describing general builder settings + cell-specification * + row/colum spans + row heights + row groups. See the examples. * The digits and underscores specify which component goes into which cell(s) * of the layout grid (cell-specification). There can be at most one character * for every (non-gap) column specified by <code>cols</code>. Rows must be * separated by the '|' character. Only underscores, digits and letters are * allowed in the cell-specification (space isn't). Underscore means that a * cell is empty. A digit/letter character refers to a component in the varargs * list: '0'..'9', 'A'..'Z', 'a'..'z' (in this order) denote the first 62 * components of the <code>args</code> list. Repeating the same digit specifies * the component's column span (and row span, if repeated in consecutive rows * in the same columns, like '3' in the example).<br> * After the cell-specification, but before the newline ('|') character * the row height and row grouping can also be specified. It must begin * with a space to separate it from the cell-specification. The row * height can be a gap-character (for constant heights only) or a string * that is interpreted by RowSpec.decodeSpecs(). If omitted, the height * spec. of the most recent row is inherited. Content rows inherit the * height of the previous content row, gap rows inherit the height of * the previous gap row. A row is a gap row if its cell-specification is * omitted.<br> * Row grouping forces equal heights to every member of the group. It * can be specified by "grp?" strings using any character in place of * '?' (except space and '|'. In the example 'grp1' uses '1'). Rows * using the same grouping character will be in the same group. * By default there're no groups. * <br> * General builder-settings can be specified at the beginning of the * string, enclosed in square brackets ([..]). (No space is allowed * after the closing ']'). This is intended for future extensions, too. * The list of available settings is described at the {@link Prop} * enumeration. Note that setting names are case-sensitive, and should * be separated by commas. * @param args List of components. Besides java.awt.Component objects, * the caller may use plain strings and instances of the {@link Separator} * class. Plain strings are used to create labels (with mnemonic-expansion). * Separator objects will create and add separators to the form. * Any of these objects may be followed optionally by a {@link CellConstraints}, * a {@link CellConstraints.Alignment} or a {@link CellInsets} object, * which overrides the cell's default alignment, can extend its row/column * span and adjust its insets.<br> * If the first element of <code>args</code> is a java.util.Map object, * it is treated as an additional mapping for gap-characters. This * overrides the default global mapping. Note that gap-characters can * help you to set up uniform spacing on your forms. For example, if * you use "-" as normal column-gap and "~" as normal row-gap, fine-tuning * the sizes of these gaps later is as easy as changing the mapping for "-" * and "~" — there's no need to update all the dlu sizes in all layouts. * @see * Example1: <pre> * build("6dlu, p, 6dlu, 50dlu, 6dlu", * "_0_1_ pref| 6dlu|" + * "_2_33 pref:grow(0.5) grp1||" + * "_4_33 grp1", * component0, component1, component2, component3, * component4, cellConstraintsForComponent4).getPanel() * </pre> * The same exaple with gap-characters: <pre> * build("~ p ~ 50dlu, 6dlu", * "01_ pref|~|" + * "233 pref:grow(0.5) grp1||" + * "433 grp1", * component0, component1, component2, component3, * component4, cellConstraintsForComponent4).getPanel() * </pre> * Example3 (only the second argument): <pre> * "[LineGapSize=6dlu, ParagraphGapSize=20dlu]_0_1||_2_3||_4_5" * </pre> * Note: this method can be used with no components and empty cell-specification, * too. In this case only a {@link DefaultFormBuilder} is created, configured * and returned. Its operations can then be used to append components to the form. */ @SuppressWarnings("unchecked") public static DefaultFormBuilder build(String cols, String rows, Object... args) { Context ctx = new Context(); // Parse column widths // int firstArg = 0; if (args.length > 0 && args[0] instanceof java.util.Map) { ctx.localGapSpec = (java.util.Map<Character, String>) args[0]; firstArg += 1; } StringBuilder colstmp = new StringBuilder(); ctx.contentCol = parseColumnWidths(colstmp, cols, ctx.localGapSpec, 0); // Parse the list of components (may include individual cell-constraints) // ctx.components = new ArrayList<Rec>(args.length); for (int i = firstArg; i < args.length; ++i) { Rec r = new Rec(args[i]); if (i + 1 < args.length) { if (args[i + 1] instanceof CellConstraints) { r.cc = (CellConstraints) args[++i]; r.useAlignment = true; } else if (args[i + 1] instanceof CellConstraints.Alignment) { CellConstraints.Alignment a = (CellConstraints.Alignment) args[++i]; if (a == CellConstraints.BOTTOM || a == CellConstraints.TOP) r.cc = new CellConstraints(1, 1, CellConstraints.DEFAULT, a); else if (a == CellConstraints.LEFT || a == CellConstraints.RIGHT) r.cc = new CellConstraints(1, 1, a, CellConstraints.DEFAULT); else if (a == CellConstraints.CENTER || a == CellConstraints.FILL) r.cc = new CellConstraints(1, 1, a, a); r.useAlignment = (r.cc != null); } else if (args[i + 1] instanceof CellInsets) { CellInsets ci = ((CellInsets) args[++i]); r.cc = ci.cc; r.useAlignment = ci.useAlignment; r.useInsets = true; //} //else if (args[i+1] == null) { // this would allow superfluous 'null' values // i += 1; } } ctx.components.add(r); } // Parse general settings (but don't apply yet) // EnumMap<Prop, Object> props = null; int i = rows.indexOf(']'); if (i >= 0) { String defaults = rows.substring(0, i); rows = rows.substring(++i); i = defaults.indexOf('['); ctx.input = defaults.substring(++i); props = Prop.parseGeneralSettings(ctx); } // Parse cell-specification, row heights and row groups // String cells[] = rows.split("\\|", -1); StringBuilder rowstmp = new StringBuilder(); java.util.HashMap<Character, int[]> rowGroups = new HashMap<Character, int[]>(); String lastContentRowHeight = "p", lastGapRowHeight = null; int rowcnt = 0; for (i = 0; i < cells.length; ++i) { rowcnt += 1; // See if it begins with a gap-character String g = (cells[i].length() > 0) ? getGap(cells[i].charAt(0), ctx.localGapSpec) : null; if (g != null) cells[i] = ' ' + cells[i]; int j = cells[i].indexOf(' '); boolean gapRow = (j == 0) || (cells[i].length() == 0); String rh = null; if (j >= 0) { String tmp[] = cells[i].substring(j + 1).split("\\s"); // expect height and grouping specifications cells[i] = cells[i].substring(0, j); ArrayList<String> gaps = new ArrayList<String>(); for (j = 0; j < tmp.length; ++j) { if (tmp[j].length() == 0) continue; if (tmp[j].length() == 4 && tmp[j].toLowerCase().startsWith("grp")) { Character groupch = tmp[j].charAt(3); rowGroups.put(groupch, appendIntArray(rowGroups.get(groupch), rowcnt)); } else { rh = tmp[j]; for (int k = 0, n = tmp[j].length(); k < n && addGap(gaps, getGap(tmp[j].charAt(k), ctx.localGapSpec)); ++k) ; } } if (!gaps.isEmpty()) { StringBuilder sb = new StringBuilder(); flushGaps(gaps, sb, false); rh = sb.substring(0, sb.length() - 1); } } if (rh == null) { if (gapRow && lastGapRowHeight == null) { ctx.b = new DefaultFormBuilder(new FormLayout(colstmp.toString(), "")); Prop.setBuilder(props, ctx); lastGapRowHeight = parseableRowSpec(ctx.b.getLineGapSpec()); } rh = gapRow ? lastGapRowHeight : lastContentRowHeight; } else { if (gapRow) lastGapRowHeight = rh; else lastContentRowHeight = rh; } if (i > 0) rowstmp.append(','); rowstmp.append(rh); } // Create builder // FormLayout fml = new FormLayout(colstmp.toString(), rowstmp.toString()); ctx.b = new DefaultFormBuilder(fml, debuggable()); // Apply builder settings (e.g. column groups) // Prop.setBuilder(props, ctx); props = null; // Set row groups // if (!rowGroups.isEmpty()) { int[][] tmp = new int[rowGroups.size()][]; // ??? i = 0; for (int[] a : rowGroups.values()) tmp[i++] = a; fml.setRowGroups(tmp); } rowGroups = null; JLabel lastLabel = null; java.util.HashSet<Character> done = new java.util.HashSet<Character>(ctx.components.size()); int h = cells.length; for (int y = 0; y < cells.length; ++y) { int w = cells[y].length(); int first = -1; for (int x = 0; x < w; ++x) { char ch = cells[y].charAt(x); if (ch == '_' || done.contains(ch)) continue; int idx = intValue(ch); Rec rec; try { rec = ctx.components.get(idx); } catch (IndexOutOfBoundsException e) { throw new IndexOutOfBoundsException( String.format("build() cells=\"%s\" ch=%c rows=\"%s\"", cells[y], ch, rows)); } CellConstraints cc = (rec.cc == null) ? new CellConstraints() : (CellConstraints) rec.cc.clone(); int sx = cc.gridWidth, sy = cc.gridHeight; // span x, span y while (x + sx < w && cells[y].charAt(x + sx) == ch) sx += 1; while (y + sy < h && ((x < cells[y + sy].length() && cells[y + sy].charAt(x) == ch) || (cells[y + sy].length() == 0 && y + sy + 1 < h && x < cells[y + sy + 1].length() && cells[y + sy + 1].charAt(x) == ch))) { sy += 1; } int colSpan = ctx.contentCol[x + sx - 1] - ctx.contentCol[x] + 1; ctx.b.setBounds(ctx.contentCol[x] + 1, ctx.b.getRow(), colSpan, sy); ctx.b.setLeadingColumnOffset(first & ctx.contentCol[x]); // 0 vagy x (itt nem kell a +1) first = 0; x += (sx - 1); Object comp = ctx.components.get(idx).component; if (comp instanceof Component) { ctx.b.append((Component) comp, colSpan); if (comp instanceof JLabel) lastLabel = (JLabel) comp; else { if (lastLabel != null) lastLabel.setLabelFor((Component) comp); lastLabel = null; } } else if (comp instanceof Separator) { comp = ctx.b.appendSeparator(comp.toString()); lastLabel = null; } else { comp = lastLabel = ctx.b.getComponentFactory().createLabel(comp.toString()); ctx.b.append(lastLabel, colSpan); } if (rec.useAlignment || rec.useInsets) { CellConstraints cc2 = fml.getConstraints((Component) comp); cc2.insets = cc.insets; cc2.hAlign = cc.hAlign; cc2.vAlign = cc.vAlign; fml.setConstraints((Component) comp, cc2); } done.add(ch); } lastLabel = null; ctx.b.nextLine(); } return ctx.b; }
From source file:ambit2.dbui.dictionary.DictionaryQueryPanel.java
License:Open Source License
public JComponent buildPanel() { initRows();/*from ww w . j a v a2 s . co m*/ FormLayout layout = new FormLayout("331dlu", "pref,48dlu,pref:grow"); PanelBuilder panel = new PanelBuilder(layout); panel.setDefaultDialogBorder(); CellConstraints cc = new CellConstraints(); JComponent c = null; c = createNavigator(panel.getPanel(), path); // c.setBackground(panel.getPanel().getBackground()); // c.setBorder(BorderFactory.createRaisedBevelBorder()); panel.addSeparator("Filter by templates", cc.xywh(1, 1, 1, 1)); panel.add(c, cc.xywh(1, 2, 1, 1)); panel.add(createValueComponent(), cc.xywh(1, 3, 1, 1)); return panel.getPanel(); }
From source file:ambit2.dbui.QueryDatasetEditor.java
License:Open Source License
public JComponent buildPanel() { datasets = new AmbitRows<SourceDataset>(); FormLayout layout = new FormLayout("75dlu,3dlu,125dlu,3dlu,125dlu", "pref,pref"); PanelBuilder panel = new PanelBuilder(layout); panel.setDefaultDialogBorder();//from ww w . j a va2 s . c om CellConstraints cc = new CellConstraints(); panel.addSeparator("Dataset name", cc.xywh(1, 1, 5, 1)); JComponent c = createConditionComponent(); if (c != null) panel.add(c, cc.xywh(1, 2, 1, 1)); c = createValueComponent(); if (c != null) panel.add(c, cc.xywh(3, 2, 3, 1)); return panel.getPanel(); }