List of usage examples for javax.swing.event ListSelectionListener ListSelectionListener
ListSelectionListener
From source file:com.funambol.email.admin.user.ResultSearchUserPanel.java
/** * Set up graphic elements for this panel. * * @throws Exception if error occures during creation of the panel */// w w w . ja va 2 s .c o m private void init() throws Exception { // create objects to display this.setLayout(new BorderLayout()); this.setBorder(BorderFactory.createEmptyBorder()); // create a model for the user table and pass it to the JTable object model = new UserTableModel(); table = new JTable(model); table.setShowGrid(true); table.setAutoscrolls(true); table.setSelectionMode(DefaultListSelectionModel.SINGLE_SELECTION); JScrollPane scrollpane = new JScrollPane(table); table.setPreferredScrollableViewportSize(new Dimension(800, 200)); table.setFont(GuiFactory.defaultTableFont); table.getTableHeader().setFont(GuiFactory.defaultTableHeaderFont); this.add(scrollpane, BorderLayout.CENTER); // // Select user. // table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); ListSelectionModel rowSM = table.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent event) { if (event.getValueIsAdjusting()) { return; } ListSelectionModel lsm = (ListSelectionModel) event.getSource(); if (lsm.isSelectionEmpty()) { selectedUser = null; } else { int selectedRow = lsm.getMinSelectionIndex(); selectedUser = users[selectedRow]; } } }); rowSM.clearSelection(); table.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent event) { if (event.getClickCount() < 2) { return; } // // If the selected user is already associated to an account // then insertion process can't go on. // String userName = selectedUser.getUsername(); String value[] = new String[] { userName }; WhereClause wc = new WhereClause("username", value, WhereClause.OPT_EQ, true); MailServerAccount[] tmp = null; try { tmp = WSDao.getAccounts(wc); } catch (Exception e) { } if (tmp.length > 0) { StringBuilder sb = new StringBuilder("The user "); sb.append(userName).append(" is already associated to an account"); Object[] options = { "OK" }; JOptionPane.showOptionDialog(null, sb.toString(), "Warning", JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]); } else { // // Go to next step. // step.goToNextStep(); } } }); }
From source file:com.mirth.connect.client.ui.attachments.RegexAttachmentDialog.java
private void initOutboundReplacementTable() { DefaultTableModel model = new DefaultTableModel(new Object[][] {}, new String[] { "Replace All", "Replace With" }) { public boolean isCellEditable(int rowIndex, int columnIndex) { return true; }/*www . ja v a 2 s .c o m*/ }; outboundReplacementTable.setSortable(false); outboundReplacementTable.getTableHeader().setReorderingAllowed(false); outboundReplacementTable.setModel(model); outboundReplacementTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { outboundDeleteButton.setEnabled(outboundReplacementTable.getSelectedRow() != -1); } }); if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) { outboundReplacementTable.setHighlighters(HighlighterFactory .createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR, UIConstants.BACKGROUND_COLOR)); } outboundDeleteButton.setEnabled(false); }
From source file:fr.free.hd.servers.gui.FaceView.java
private JList CreateList() { Collection<Face> faces = facesDAO.getFaces(); final JList list = new JList(faces.toArray()); list.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override//from w w w . j a v a 2 s. co m public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting() == false) { face = (Face) list.getSelectedValue(); } } }); return list; }
From source file:edu.ku.brc.specify.config.init.TreeDefSetupPanel.java
/** * @param classType the class of the TreeDef * @param classTitle the already localized title of the actual tree * @param panelName the name of the panel * @param descKey L10N key to label description above the table * @param nextBtn the next button/* w w w .j av a 2 s . c om*/ * @param dbPanel the */ public TreeDefSetupPanel(final Class<?> classType, final String classTitle, final String panelName, final String helpContext, final String descKey, final JButton nextBtn, final JButton prevBtn, final DisciplinePanel disciplinePanel) { super(panelName, helpContext, nextBtn, prevBtn); this.classType = classType; this.classTitle = classTitle; this.disciplinePanel = disciplinePanel; if (classType == TaxonTreeDef.class || classType == GeographyTreeDef.class || classType == StorageTreeDef.class) { model = new TreeDefTableModel(); if (classType != TaxonTreeDef.class) { loadTree(disciplinePanel != null && disciplinePanel.getDisciplineType() != null ? disciplinePanel.getDisciplineType().getDisciplineType() : null); } table = new JTable(model); directionCBX = UIHelper .createComboBox(new String[] { getResourceString("FORWARD"), getResourceString("REVERSE") }); fullnameDisplayTxt = new JEditorPane(); fullnameDisplayTxt.setBackground(Color.WHITE); fullnameDisplayTxt.setOpaque(true); fullnameDisplayTxt.setContentType("text/html"); fullnameDisplayTxt.setEditable(false); table.setRowSelectionAllowed(false); table.setColumnSelectionAllowed(false); //table.setDefaultRenderer(String.class, new BiColorTableCellRenderer(false)); model.addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent e) { updateBtnUI(); } }); JScrollPane spex = new JScrollPane(fullnameDisplayTxt, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); CellConstraints cc = new CellConstraints(); PanelBuilder pb = new PanelBuilder( new FormLayout("p,2px,p,250px,f:p:g", "p,4px,min(p;250px),4px,p,4px,65px,2px,p"), this); JScrollPane sp = createScrollPane(table); sp.getViewport().setBackground(Color.WHITE); String lbl = getLocalizedMessage(descKey, classTitle); pb.add(createLabel(lbl, SwingConstants.CENTER), cc.xyw(1, 1, 4)); pb.add(sp, cc.xyw(1, 3, 5)); pb.add(createI18NFormLabel("DIRECTION"), cc.xy(1, 5)); pb.add(directionCBX, cc.xy(3, 5)); pb.add(createI18NFormLabel("EXAMPLE"), cc.xy(1, 7)); pb.add(spex, cc.xywh(3, 7, 2, 3)); makeTableHeadersCentered(table, true); directionCBX.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateBtnUI(); } }); table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { updateBtnUI(); int inx = table.getSelectedColumn(); if (inx > -1) { TreeDefRow row = treeDefList.get(table.getSelectedRow()); String msgKey = null; if (row.isRequired() && (inx == 1 || inx == 3)) { msgKey = inx == 1 ? "NO_CHANGE_INCL" : "NO_CHANGE_REQ"; } else if (inx == 4 && !row.isIncluded()) { msgKey = "NO_CHANGE_INFN"; } if (msgKey != null) { final String mk = msgKey; SwingUtilities.invokeLater(new Runnable() { @Override public void run() { showLocalizedMsg(mk); } }); } } } } }); updateBtnUI(); } }
From source file:filterviewplugin.FilterViewSettingsTab.java
public JPanel createSettingsPanel() { final EnhancedPanelBuilder panelBuilder = new EnhancedPanelBuilder(FormFactory.RELATED_GAP_COLSPEC.encode() + ',' + FormFactory.PREF_COLSPEC.encode() + ',' + FormFactory.RELATED_GAP_COLSPEC.encode() + ',' + FormFactory.PREF_COLSPEC.encode() + ", fill:default:grow"); final CellConstraints cc = new CellConstraints(); final JLabel label = new JLabel(mLocalizer.msg("daysToShow", "Days to show")); panelBuilder.addRow();/* w w w . j av a 2 s . co m*/ panelBuilder.add(label, cc.xy(2, panelBuilder.getRow())); final SpinnerNumberModel model = new SpinnerNumberModel(3, 1, 7, 1); mSpinner = new JSpinner(model); mSpinner.setValue(mSettings.getDays()); panelBuilder.add(mSpinner, cc.xy(4, panelBuilder.getRow())); panelBuilder.addParagraph(mLocalizer.msg("filters", "Filters to show")); mFilterList = new SelectableItemList(mSettings.getActiveFilterNames(), FilterViewSettings.getAvailableFilterNames()); mIcons.clear(); for (String filterName : FilterViewSettings.getAvailableFilterNames()) { mIcons.put(filterName, mSettings.getFilterIconName(mSettings.getFilter(filterName))); } mFilterList.addCenterRendererComponent(String.class, new SelectableItemRendererCenterComponentIf() { private DefaultListCellRenderer mRenderer = new DefaultListCellRenderer(); public void calculateSize(JList list, int index, JPanel contentPane) { } public JPanel createCenterPanel(JList list, Object value, int index, boolean isSelected, boolean isEnabled, JScrollPane parentScrollPane, int leftColumnWidth) { DefaultListCellRenderer label = (DefaultListCellRenderer) mRenderer .getListCellRendererComponent(list, value, index, isSelected, false); String filterName = value.toString(); String iconFileName = mIcons.get(filterName); Icon icon = null; if (!StringUtils.isEmpty(iconFileName)) { try { icon = FilterViewPlugin.getInstance().getIcon( FilterViewSettings.getIconDirectoryName() + File.separatorChar + iconFileName); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } label.setIcon(icon); } String text = filterName; if (icon == null) { text += " (" + mLocalizer.msg("noIcon", "no icon") + ')'; } label.setText(text); label.setHorizontalAlignment(SwingConstants.LEADING); label.setVerticalAlignment(SwingConstants.CENTER); label.setOpaque(false); JPanel panel = new JPanel(new BorderLayout()); if (isSelected && isEnabled) { panel.setOpaque(true); panel.setForeground(list.getSelectionForeground()); panel.setBackground(list.getSelectionBackground()); } else { panel.setOpaque(false); panel.setForeground(list.getForeground()); panel.setBackground(list.getBackground()); } panel.add(label, BorderLayout.WEST); return panel; } }); panelBuilder.addGrowingRow(); panelBuilder.add(mFilterList, cc.xyw(2, panelBuilder.getRow(), panelBuilder.getColumnCount() - 1)); panelBuilder.addRow(); mFilterButton = new JButton(mLocalizer.msg("changeIcon", "Change icon")); mFilterButton.setEnabled(false); panelBuilder.add(mFilterButton, cc.xyw(2, panelBuilder.getRow(), 1)); mRemoveButton = new JButton(mLocalizer.msg("deleteIcon", "Remove icon")); mRemoveButton.setEnabled(false); panelBuilder.add(mRemoveButton, cc.xyw(4, panelBuilder.getRow(), 1)); mFilterButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SelectableItem item = (SelectableItem) mFilterList.getSelectedValue(); String filterName = (String) item.getItem(); chooseIcon(filterName); } }); mFilterList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { mFilterButton.setEnabled(mFilterList.getSelectedValue() != null); mRemoveButton.setEnabled(mFilterButton.isEnabled()); } }); mRemoveButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SelectableItem item = (SelectableItem) mFilterList.getSelectedValue(); String filterName = (String) item.getItem(); mIcons.put(filterName, ""); mFilterList.updateUI(); } }); return panelBuilder.getPanel(); }
From source file:br.upe.ecomp.dosa.view.wizard.WizardAction.java
private void initStopConditions() { addStopConditions();/* w ww.j av a2 s . co m*/ stopConditionSelectedList.setModel(new DefaultListModel()); stopConditionDescriptionTextArea.setText(""); updateStopConditionButtonsStatus(); stopConditionAvailableList.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(final ListSelectionEvent evt) { stopConditionAvailableListSelectionListner(); } }); stopConditionSelectedList.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(final ListSelectionEvent evt) { stopConditionSelectedListSelectionListner(); } }); }
From source file:com.mirth.connect.client.ui.NotificationDialog.java
private void initComponents() { setLayout(new MigLayout("insets 12", "[]", "[fill][]")); notificationPanel = new JPanel(); notificationPanel.setLayout(new MigLayout("insets 0 0 0 0, fill", "[200!][]", "[25!]0[]")); notificationPanel.setBackground(UIConstants.BACKGROUND_COLOR); archiveAll = new JLabel("Archive All"); archiveAll.setForeground(java.awt.Color.blue); archiveAll.setText("<html><u>Archive All</u></html>"); archiveAll.setToolTipText("Archive all notifications below."); archiveAll.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); newNotificationsLabel = new JLabel(); newNotificationsLabel.setFont(newNotificationsLabel.getFont().deriveFont(Font.BOLD)); headerListPanel = new JPanel(); headerListPanel.setBackground(UIConstants.HIGHLIGHTER_COLOR); headerListPanel.setLayout(new MigLayout("insets 2, fill")); headerListPanel.setBorder(BorderFactory.createLineBorder(borderColor)); list = new JList(); list.setCellRenderer(new NotificationListCellRenderer()); list.addListSelectionListener(new ListSelectionListener() { @Override/* w w w.ja va 2 s .c om*/ public void valueChanged(ListSelectionEvent event) { if (!event.getValueIsAdjusting()) { currentNotification = (Notification) list.getSelectedValue(); if (currentNotification != null) { notificationNameTextField.setText(currentNotification.getName()); contentTextPane.setText(currentNotification.getContent()); archiveSelected(); } } } }); listScrollPane = new JScrollPane(); listScrollPane.setBackground(UIConstants.BACKGROUND_COLOR); listScrollPane.setBorder(BorderFactory.createMatteBorder(0, 1, 1, 1, borderColor)); listScrollPane.setViewportView(list); listScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); archiveLabel = new JLabel(); archiveLabel.setForeground(java.awt.Color.blue); archiveLabel.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); notificationNameTextField = new JTextField(); notificationNameTextField.setFont(notificationNameTextField.getFont().deriveFont(Font.BOLD)); notificationNameTextField.setEditable(false); notificationNameTextField.setFocusable(false); notificationNameTextField.setBorder(BorderFactory.createEmptyBorder()); notificationNameTextField.setBackground(UIConstants.HIGHLIGHTER_COLOR); DefaultCaret nameCaret = (DefaultCaret) notificationNameTextField.getCaret(); nameCaret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE); headerContentPanel = new JPanel(); headerContentPanel.setLayout(new MigLayout("insets 2, fill")); headerContentPanel.setBorder(BorderFactory.createLineBorder(borderColor)); headerContentPanel.setBackground(UIConstants.HIGHLIGHTER_COLOR); contentTextPane = new JTextPane(); contentTextPane.setContentType("text/html"); contentTextPane.setEditable(false); contentTextPane.addHyperlinkListener(new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent evt) { if (evt.getEventType() == EventType.ACTIVATED && Desktop.isDesktopSupported()) { try { if (Desktop.isDesktopSupported()) { Desktop.getDesktop().browse(evt.getURL().toURI()); } else { BareBonesBrowserLaunch.openURL(evt.getURL().toString()); } } catch (Exception e) { e.printStackTrace(); } } } }); DefaultCaret contentCaret = (DefaultCaret) contentTextPane.getCaret(); contentCaret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE); contentScrollPane = new JScrollPane(); contentScrollPane.setViewportView(contentTextPane); contentScrollPane.setBorder(BorderFactory.createMatteBorder(0, 1, 1, 1, borderColor)); archiveLabel.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { int index = list.getSelectedIndex(); if (currentNotification.isArchived()) { notificationModel.setArchived(false, index); unarchivedCount++; } else { notificationModel.setArchived(true, index); unarchivedCount--; } archiveSelected(); updateUnarchivedCountLabel(); } }); archiveAll.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { for (int i = 0; i < notificationModel.getSize(); i++) { notificationModel.setArchived(true, i); } unarchivedCount = 0; archiveSelected(); updateUnarchivedCountLabel(); } }); notificationCheckBox = new JCheckBox("Show new notifications on login"); notificationCheckBox.setBackground(UIConstants.BACKGROUND_COLOR); if (checkForNotifications == null || BooleanUtils.toBoolean(checkForNotifications)) { checkForNotificationsSetting = true; if (showNotificationPopup == null || BooleanUtils.toBoolean(showNotificationPopup)) { notificationCheckBox.setSelected(true); } else { notificationCheckBox.setSelected(false); } } else { notificationCheckBox.setSelected(false); } notificationCheckBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (notificationCheckBox.isSelected() && !checkForNotificationsSetting) { alertSettingsChange(); } } }); closeButton = new JButton("Close"); closeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { doSave(); } }); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { doSave(); } }); }
From source file:com.dnsoft.inmobiliaria.controllers.ConsultaCCPropietariosController.java
final void configuraTblPropietarios() { ((DefaultTableCellRenderer) view.tblPropietario.getTableHeader().getDefaultRenderer()) .setHorizontalAlignment(SwingConstants.CENTER); listPropietarios = new ArrayList<>(); tableModelPropietarios = new PropietariosTableModel(listPropietarios); view.tblPropietario.setModel(tableModelPropietarios); view.tblPropietario.setRowHeight(25); view.tblPropietario.getColumn("Activo").setMaxWidth(0); view.tblPropietario.getColumn("Activo").setMinWidth(0); view.tblPropietario.getColumn("Activo").setPreferredWidth(0); view.tblPropietario.getColumn("Activo").setWidth(0); view.tblPropietario.setDefaultRenderer(Object.class, new TableRendererColorActivo(2)); ListSelectionModel listModel = view.tblPropietario.getSelectionModel(); listModel.addListSelectionListener(new ListSelectionListener() { @Override//from w w w . ja v a2 s. co m public void valueChanged(ListSelectionEvent lse) { if (view.tblPropietario.getSelectedRow() != -1) { view.btnCuenta.setEnabled(true); view.btnPropietario.setEnabled(true); } else { view.btnCuenta.setEnabled(false); view.btnPropietario.setEnabled(false); } } }); view.tblPropietario.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent me) { if (me.getClickCount() == 2) { detallesCCPropietario(); } } }); }
From source file:de.tor.tribes.ui.views.DSWorkbenchAttackFrame.java
/** * Creates new form DSWorkbenchAttackFrame *///from w w w.ja v a 2 s . co m DSWorkbenchAttackFrame() { initComponents(); centerPanel = new GenericTestPanel(); jAttackPanel.add(centerPanel, BorderLayout.CENTER); centerPanel.setChildComponent(jXAttackPanel); buildMenu(); capabilityInfoPanel1.addActionListener(this); new ColorUpdateThread().start(); mCountdownThread = new CountdownThread(); mCountdownThread.start(); jXColumnList.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { updateFilter(); } }); jAttackTabPane.getModel().addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { AttackTableTab activeTab = getActiveTab(); if (activeTab != null) { activeTab.updatePlan(); } } }); setGlassPane(jxSearchPane); pack(); // <editor-fold defaultstate="collapsed" desc=" Init HelpSystem "> if (!Constants.DEBUG) { GlobalOptions.getHelpBroker().enableHelpKey(getRootPane(), "pages.attack_view", GlobalOptions.getHelpBroker().getHelpSet()); } // </editor-fold> }
From source file:net.openbyte.gui.WelcomeFrame.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - Gary Lee scrollPane1 = new JScrollPane(); list1 = new JList(); button1 = new JButton(); label2 = new JLabel(); button2 = new JButton(); button3 = new JButton(); button4 = new JButton(); button5 = new JButton(); scrollPane2 = new JScrollPane(); xImagePanel1 = new JXImagePanel(); button6 = new JButton(); button7 = new JButton(); button8 = new JButton(); //======== this ======== setTitle("Welcome to OpenByte"); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setResizable(false);/*from w ww . j a v a2 s.c o m*/ Container contentPane = getContentPane(); contentPane.setLayout(null); //======== scrollPane1 ======== { scrollPane1.setBorder(new TitledBorder(LineBorder.createGrayLineBorder(), "Recent Projects")); //---- list1 ---- list1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list1.setBackground(new Color(240, 240, 240)); list1.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { list1ValueChanged(e); } }); scrollPane1.setViewportView(list1); } contentPane.add(scrollPane1); scrollPane1.setBounds(15, 10, 165, 340); //---- button1 ---- button1.setText("Open Project"); button1.setEnabled(false); button1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button1ActionPerformed(e); } }); contentPane.add(button1); button1.setBounds(105, 355, 110, button1.getPreferredSize().height); //---- label2 ---- label2.setText("Media"); contentPane.add(label2); label2.setBounds(new Rectangle(new Point(605, 210), label2.getPreferredSize())); //---- button2 ---- button2.setText("Minecraft Forums"); button2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button2ActionPerformed(e); } }); contentPane.add(button2); button2.setBounds(500, 230, 151, button2.getPreferredSize().height); //---- button3 ---- button3.setText("GitHub"); button3.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button3ActionPerformed(e); } }); contentPane.add(button3); button3.setBounds(500, 260, 150, button3.getPreferredSize().height); //---- button4 ---- button4.setText("+"); button4.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button4ActionPerformed(e); } }); contentPane.add(button4); button4.setBounds(15, 355, 45, button4.getPreferredSize().height); //---- button5 ---- button5.setText("-"); button5.setEnabled(false); button5.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button5ActionPerformed(e); } }); contentPane.add(button5); button5.setBounds(60, 355, 40, button5.getPreferredSize().height); //======== scrollPane2 ======== { scrollPane2.setBorder(null); scrollPane2.setViewportView(xImagePanel1); } contentPane.add(scrollPane2); scrollPane2.setBounds(210, 25, 445, 160); //---- button6 ---- button6.setText("Preferences"); button6.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button6ActionPerformed(e); } }); contentPane.add(button6); button6.setBounds(500, 290, 150, 30); //---- button7 ---- button7.setText("About"); button7.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button7ActionPerformed(e); } }); contentPane.add(button7); button7.setBounds(500, 320, 150, 30); //---- button8 ---- button8.setText("Plugins"); button8.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { button8ActionPerformed(e); } }); contentPane.add(button8); button8.setBounds(500, 350, 150, 30); { // compute preferred size Dimension preferredSize = new Dimension(); for (int i = 0; i < contentPane.getComponentCount(); i++) { Rectangle bounds = contentPane.getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); } Insets insets = contentPane.getInsets(); preferredSize.width += insets.right; preferredSize.height += insets.bottom; contentPane.setMinimumSize(preferredSize); contentPane.setPreferredSize(preferredSize); } setSize(675, 425); setLocationRelativeTo(getOwner()); // JFormDesigner - End of component initialization //GEN-END:initComponents }