List of usage examples for java.awt GridBagConstraints HORIZONTAL
int HORIZONTAL
To view the source code for java.awt GridBagConstraints HORIZONTAL.
Click Source Link
From source file:ffx.ui.KeywordPanel.java
private void loadKeywordGroup() { synchronized (this) { editPanel.removeAll();/* ww w .ja v a2 s. co m*/ String selectedGroup = (String) groupComboBox.getSelectedItem(); if (currentKeys == null) { editPanel.setLayout(flowLayout); editPanel.add(noSystemLabel); int temp = splitPane.getDividerLocation(); splitPane.setBottomComponent(noKeywordPanel); splitPane.setDividerLocation(temp); } else if (selectedGroup.equalsIgnoreCase("Flat File View")) { editPanel.setLayout(borderLayout); publishKeywords(); editPanel.add(flatfileTextArea, BorderLayout.CENTER); int temp = splitPane.getDividerLocation(); splitPane.setBottomComponent(noKeywordPanel); splitPane.setDividerLocation(temp); } else if (selectedGroup.equalsIgnoreCase("Active Keywords")) { gridPanel.removeAll(); gridBagConstraints.gridy = 0; gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.gridheight = 1; gridBagConstraints.gridwidth = 1; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; for (KeywordComponent keywordComponent : keywordHashMap.values()) { if (keywordComponent.isActive() == true) { JPanel jptemp = keywordComponent.getKeywordGUI(); gridBagLayout.setConstraints(jptemp, gridBagConstraints); gridPanel.add(jptemp); gridBagConstraints.gridy++; } } KeywordComponent.fillPanel(gridPanel, gridBagLayout, gridBagConstraints); editPanel.setLayout(flowLayout); editPanel.add(gridPanel); int temp = splitPane.getDividerLocation(); splitPane.setBottomComponent(descriptScrollPane); splitPane.setDividerLocation(temp); } else { gridPanel.removeAll(); gridBagConstraints.gridy = 0; gridBagConstraints.gridx = 0; gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.gridheight = 1; gridBagConstraints.gridwidth = 1; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; for (KeywordComponent keywordComponent : keywordHashMap.values()) { if (keywordComponent.getKeywordGroup().equalsIgnoreCase(selectedGroup)) { JPanel jptemp = keywordComponent.getKeywordGUI(); gridBagLayout.setConstraints(jptemp, gridBagConstraints); gridPanel.add(jptemp); gridBagConstraints.gridy++; } } KeywordComponent.fillPanel(gridPanel, gridBagLayout, gridBagConstraints); editPanel.setLayout(flowLayout); editPanel.add(gridPanel); int temp = splitPane.getDividerLocation(); splitPane.setBottomComponent(descriptScrollPane); splitPane.setDividerLocation(temp); } if (currentKeyFile != null) { statusLabel.setText(" " + currentKeyFile.toString()); } else { statusLabel.setText(" "); } editScrollPane.validate(); editScrollPane.repaint(); } }
From source file:com.microsoft.azure.hdinsight.spark.ui.SparkSubmissionContentPanel.java
private void addReferencedJarsLineItem() { JLabel commandLineArgs = new JLabel("Referenced Jars"); commandLineArgs.setToolTipText(//from w w w.ja v a2 s .c o m "Files to be placed on the java classpath; The path needs to be a Azure Blob Storage Path (path started with wasb://); Multiple paths should be split by semicolon (;)"); add(commandLineArgs, new GridBagConstraints(0, ++displayLayoutCurrentRow, 1, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(margin, margin, 0, 0), 0, 0)); referencedJarsTextField = new JTextField(); referencedJarsTextField.setToolTipText( "Files to be placed on the java classpath; The path needs to be a Azure Blob Storage Path (path started with wasb://); Multiple paths should be split by semicolon (;)"); add(referencedJarsTextField, new GridBagConstraints(1, displayLayoutCurrentRow, 0, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(margin, margin, 0, margin), 0, 0)); }
From source file:com.sshtools.appframework.ui.SshToolsApplication.java
/** * Show an 'About' dialog//from www . j a v a 2 s .co m */ public void showAbout(Component parent) { JPanel p = new JPanel(new GridBagLayout()); p.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); GridBagConstraints gBC = new GridBagConstraints(); gBC.anchor = GridBagConstraints.CENTER; gBC.fill = GridBagConstraints.HORIZONTAL; gBC.insets = new Insets(1, 1, 1, 1); JLabel a = new JLabel(getApplicationName()); a.setFont(a.getFont().deriveFont(24f)); UIUtil.jGridBagAdd(p, a, gBC, GridBagConstraints.REMAINDER); JLabel v = new JLabel("Version " + getApplicationVersion()); v.setFont(v.getFont().deriveFont(10f)); UIUtil.jGridBagAdd(p, v, gBC, GridBagConstraints.REMAINDER); MultilineLabel x = new MultilineLabel(getAboutLicenseDetails()); x.setBorder(BorderFactory.createEmptyBorder(8, 0, 8, 0)); x.setFont(x.getFont().deriveFont(12f)); UIUtil.jGridBagAdd(p, x, gBC, GridBagConstraints.REMAINDER); MultilineLabel c = new MultilineLabel(getExpiryInfo()); c.setFont(c.getFont().deriveFont(10f)); UIUtil.jGridBagAdd(p, c, gBC, GridBagConstraints.REMAINDER); final JLabel h = new JLabel(getAboutURL()); h.setForeground(Color.blue); h.setFont(new Font(h.getFont().getName(), Font.BOLD, 10)); h.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); h.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent evt) { try { BrowserLauncher.openURL(getAboutURL()); } catch (IOException ioe) { ioe.printStackTrace(); } } }); UIUtil.jGridBagAdd(p, h, gBC, GridBagConstraints.REMAINDER); JOptionPane.showMessageDialog(parent, p, "About", JOptionPane.PLAIN_MESSAGE, getApplicationLargeIcon()); }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.UserProfile.java
/** * Builds the UI component hosting the UI component used to modify * the password.// w ww. j av a2 s . c o m * * @return See above. */ private JPanel buildPasswordPanel() { JPanel content = new JPanel(); content.setBackground(UIUtilities.BACKGROUND_COLOR); Registry reg = MetadataViewerAgent.getRegistry(); String ldap = (String) reg.lookup(LookupNames.USER_AUTHENTICATION); if (ldap != null && ldap.length() > 0) { content.setBorder(BorderFactory.createTitledBorder("LDAP Authentication")); content.setLayout(new FlowLayout(FlowLayout.LEFT)); content.add(new JLabel(ldap)); return content; } content.setBorder(BorderFactory.createTitledBorder("Change Password")); content.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(0, 2, 2, 0); c.gridx = 0; c.gridy = 0; c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last c.fill = GridBagConstraints.NONE; c.weightx = 0.0; if (MetadataViewerAgent.isAdministrator()) { content.add(UIUtilities.setTextFont(PASSWORD_NEW), c); c.gridx++; c.gridwidth = GridBagConstraints.REMAINDER; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; content.add(passwordNew, c); } else { content.add(UIUtilities.setTextFont(PASSWORD_OLD), c); c.gridx++; c.gridwidth = GridBagConstraints.REMAINDER; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; content.add(oldPassword, c); c.gridy++; c.gridx = 0; c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last c.fill = GridBagConstraints.NONE; c.weightx = 0.0; content.add(UIUtilities.setTextFont(PASSWORD_NEW), c); c.gridx++; c.gridwidth = GridBagConstraints.REMAINDER; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; content.add(passwordNew, c); c.gridy++; c.gridx = 0; c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last c.fill = GridBagConstraints.NONE; c.weightx = 0.0; content.add(UIUtilities.setTextFont(PASSWORD_CONFIRMATION), c); c.gridx++; c.gridwidth = GridBagConstraints.REMAINDER; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; content.add(passwordConfirm, c); c.gridy++; c.gridx = 0; } JPanel p = new JPanel(); p.setBackground(UIUtilities.BACKGROUND_COLOR); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); p.add(content); JPanel buttonPanel = UIUtilities.buildComponentPanel(passwordButton); buttonPanel.setBackground(UIUtilities.BACKGROUND_COLOR); p.add(buttonPanel); return p; }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.AnnotationDataUI.java
/** * Lays out the other annotations.//from w ww . ja va2 s. c om * * @param list The collection of annotation to layout. */ private void layoutOthers(Collection list) { otherPane.removeAll(); otherList.clear(); DocComponent doc; GridBagConstraints c = new GridBagConstraints(); c.anchor = GridBagConstraints.WEST; c.insets = new Insets(1, 2, 1, 2); c.gridx = 0; c.gridy = 0; c.weightx = 0; c.weighty = 0; c.fill = GridBagConstraints.NONE; if (!CollectionUtils.isEmpty(list)) { Iterator i = list.iterator(); while (i.hasNext()) { c.gridx = 0; c.weightx = 0; c.fill = GridBagConstraints.NONE; DataObject item = (DataObject) i.next(); if (filter == SHOW_ALL || (filter == ADDED_BY_ME && model.isLinkOwner(item)) || (filter == ADDED_BY_OTHERS && model.isAnnotatedByOther(item))) { doc = new DocComponent(item, model); doc.addPropertyChangeListener(controller); otherList.add(doc); otherPane.add(new JLabel(getType((AnnotationData) item) + ":"), c); c.gridx = 1; c.weightx = 1; c.fill = GridBagConstraints.HORIZONTAL; otherPane.add(doc, c); c.gridy++; } } } otherPane.revalidate(); otherPane.repaint(); }
From source file:org.eclipse.wb.internal.swing.preferences.laf.LafPreferencePage.java
/** * Creates {@link EmbeddedSwingComposite} with some Swing components to show it using different * LAFs.//from ww w . j a v a 2 s. co m */ private void createPreviewArea(Group previewGroup) { try { LookAndFeel currentLookAndFeel = UIManager.getLookAndFeel(); EmbeddedSwingComposite awtComposite = new EmbeddedSwingComposite(previewGroup, SWT.NONE) { @Override protected JComponent createSwingComponent() { // create the JRootPane JRootPane rootPane = new JRootPane(); { JMenuBar menuBar = new JMenuBar(); rootPane.setJMenuBar(menuBar); { JMenu mnFile = new JMenu(Messages.LafPreferencePage_previewFile); menuBar.add(mnFile); { JMenuItem mntmNew = new JMenuItem(Messages.LafPreferencePage_previewNew); mnFile.add(mntmNew); } { JMenuItem mntmExit = new JMenuItem(Messages.LafPreferencePage_previewExit); mnFile.add(mntmExit); } } { JMenu mnView = new JMenu(Messages.LafPreferencePage_previewView); menuBar.add(mnView); { JMenuItem mntmCommon = new JMenuItem(Messages.LafPreferencePage_previewCommon); mnView.add(mntmCommon); } } } GridBagLayout gridBagLayout = new GridBagLayout(); gridBagLayout.columnWidths = new int[] { 0, 0, 0 }; gridBagLayout.rowHeights = new int[] { 0, 0, 0, 0 }; gridBagLayout.columnWeights = new double[] { 0.0, 0.0, 1.0E-4 }; gridBagLayout.rowWeights = new double[] { 0.0, 0.0, 0.0, 1.0E-4 }; rootPane.getContentPane().setLayout(gridBagLayout); { JLabel lblLabel = new JLabel(Messages.LafPreferencePage_previewLabel); GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(0, 0, 5, 5); gbc.gridx = 0; gbc.gridy = 0; rootPane.getContentPane().add(lblLabel, gbc); } { JButton btnPushButton = new JButton(Messages.LafPreferencePage_previewButton); GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(0, 0, 5, 0); gbc.gridx = 1; gbc.gridy = 0; rootPane.getContentPane().add(btnPushButton, gbc); } { JComboBox comboBox = new JComboBox(); comboBox.setModel(new DefaultComboBoxModel(new String[] { Messages.LafPreferencePage_previewCombo, "ComboBox Item 1", "ComboBox Item 2" })); GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(0, 0, 5, 5); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridx = 0; gbc.gridy = 1; rootPane.getContentPane().add(comboBox, gbc); } { JRadioButton rdbtnRadioButton = new JRadioButton(Messages.LafPreferencePage_previewRadio); GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(0, 0, 5, 0); gbc.gridx = 1; gbc.gridy = 1; rootPane.getContentPane().add(rdbtnRadioButton, gbc); } { JCheckBox chckbxCheckbox = new JCheckBox(Messages.LafPreferencePage_previewCheck); GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(0, 0, 0, 5); gbc.gridx = 0; gbc.gridy = 2; rootPane.getContentPane().add(chckbxCheckbox, gbc); } { JTextField textField = new JTextField(); textField.setText(Messages.LafPreferencePage_previewTextField); GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridx = 1; gbc.gridy = 2; rootPane.getContentPane().add(textField, gbc); } return rootPane; } }; awtComposite.populate(); // restore current laf UIManager.put("ClassLoader", currentLookAndFeel.getClass().getClassLoader()); UIManager.setLookAndFeel(currentLookAndFeel); } catch (Throwable e) { DesignerPlugin.log(e); } }
From source file:org.freeplane.view.swing.features.time.mindmapmode.NodeList.java
public void startup() { if (dialog != null) { dialog.toFront();//from w ww . jav a 2 s . co m return; } NodeList.COLUMN_MODIFIED = TextUtils.getText(PLUGINS_TIME_LIST_XML_MODIFIED); NodeList.COLUMN_CREATED = TextUtils.getText(PLUGINS_TIME_LIST_XML_CREATED); NodeList.COLUMN_ICONS = TextUtils.getText(PLUGINS_TIME_LIST_XML_ICONS); NodeList.COLUMN_TEXT = TextUtils.getText(PLUGINS_TIME_LIST_XML_TEXT); NodeList.COLUMN_DATE = TextUtils.getText(PLUGINS_TIME_LIST_XML_DATE); NodeList.COLUMN_NOTES = TextUtils.getText(PLUGINS_TIME_LIST_XML_NOTES); dialog = new JDialog(Controller.getCurrentController().getViewController().getFrame(), modal /* modal */); String windowTitle; if (showAllNodes) { windowTitle = PLUGINS_TIME_MANAGEMENT_XML_WINDOW_TITLE_ALL_NODES; } else { windowTitle = PLUGINS_TIME_MANAGEMENT_XML_WINDOW_TITLE; } dialog.setTitle(TextUtils.getText(windowTitle)); dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); final WindowAdapter windowListener = new WindowAdapter() { @Override public void windowGainedFocus(WindowEvent e) { mFilterTextSearchField.getEditor().selectAll(); } @Override public void windowClosing(final WindowEvent event) { disposeDialog(); } }; dialog.addWindowListener(windowListener); dialog.addWindowFocusListener(windowListener); UITools.addEscapeActionToDialog(dialog, new AbstractAction() { /** * */ private static final long serialVersionUID = 1L; public void actionPerformed(final ActionEvent arg0) { disposeDialog(); } }); final Container contentPane = dialog.getContentPane(); final GridBagLayout gbl = new GridBagLayout(); contentPane.setLayout(gbl); final GridBagConstraints layoutConstraints = new GridBagConstraints(); layoutConstraints.gridx = 0; layoutConstraints.gridy = 0; layoutConstraints.gridwidth = 1; layoutConstraints.gridheight = 1; layoutConstraints.weightx = 0.0; layoutConstraints.weighty = 0.0; layoutConstraints.anchor = GridBagConstraints.WEST; layoutConstraints.fill = GridBagConstraints.HORIZONTAL; contentPane.add(new JLabel(TextUtils.getText(PLUGINS_TIME_MANAGEMENT_XML_FIND)), layoutConstraints); layoutConstraints.gridwidth = 1; layoutConstraints.gridx++; contentPane.add(Box.createHorizontalStrut(40), layoutConstraints); layoutConstraints.gridx++; contentPane.add(new JLabel(TextUtils.getText("filter_match_case")), layoutConstraints); layoutConstraints.gridx++; contentPane.add(matchCase, layoutConstraints); layoutConstraints.gridx++; contentPane.add(Box.createHorizontalStrut(40), layoutConstraints); layoutConstraints.gridx++; contentPane.add(new JLabel(TextUtils.getText("regular_expressions")), layoutConstraints); layoutConstraints.gridx++; contentPane.add(useRegexInFind, layoutConstraints); layoutConstraints.gridx = 0; layoutConstraints.weightx = 1.0; layoutConstraints.gridwidth = GridBagConstraints.REMAINDER; layoutConstraints.gridy++; contentPane.add(/* new JScrollPane */(mFilterTextSearchField), layoutConstraints); layoutConstraints.gridy++; layoutConstraints.weightx = 0.0; layoutConstraints.gridwidth = 1; contentPane.add(new JLabel(TextUtils.getText(PLUGINS_TIME_MANAGEMENT_XML_REPLACE)), layoutConstraints); layoutConstraints.gridx = 5; contentPane.add(new JLabel(TextUtils.getText("regular_expressions")), layoutConstraints); layoutConstraints.gridx++; contentPane.add(useRegexInReplace, layoutConstraints); layoutConstraints.gridx = 0; layoutConstraints.weightx = 1.0; layoutConstraints.gridwidth = GridBagConstraints.REMAINDER; layoutConstraints.gridy++; contentPane.add(/* new JScrollPane */(mFilterTextReplaceField), layoutConstraints); dateRenderer = new DateRenderer(); nodeRenderer = new NodeRenderer(); notesRenderer = new NotesRenderer(); iconsRenderer = new IconsRenderer(); timeTable = new FlatNodeTable(); timeTable.addKeyListener(new FlatNodeTableKeyListener()); timeTable.addMouseListener(new FlatNodeTableMouseAdapter()); timeTable.getTableHeader().setReorderingAllowed(false); timeTableModel = updateModel(); mFlatNodeTableFilterModel = new FlatNodeTableFilterModel(timeTableModel, NodeList.NODE_TEXT_COLUMN); sorter = new TableSorter(mFlatNodeTableFilterModel); timeTable.setModel(sorter); sorter.setTableHeader(timeTable.getTableHeader()); sorter.setColumnComparator(Date.class, TableSorter.COMPARABLE_COMPARATOR); sorter.setColumnComparator(NodeModel.class, TableSorter.LEXICAL_COMPARATOR); sorter.setColumnComparator(IconsHolder.class, TableSorter.COMPARABLE_COMPARATOR); sorter.setSortingStatus(NodeList.DATE_COLUMN, TableSorter.ASCENDING); final JScrollPane pane = new JScrollPane(timeTable); UITools.setScrollbarIncrement(pane); layoutConstraints.gridy++; GridBagConstraints tableConstraints = (GridBagConstraints) layoutConstraints.clone(); tableConstraints.weightx = 1; tableConstraints.weighty = 10; tableConstraints.fill = GridBagConstraints.BOTH; contentPane.add(pane, tableConstraints); mTreeLabel = new JLabel(); layoutConstraints.gridy++; GridBagConstraints treeConstraints = (GridBagConstraints) layoutConstraints.clone(); treeConstraints.fill = GridBagConstraints.BOTH; @SuppressWarnings("serial") JScrollPane scrollPane = new JScrollPane(mTreeLabel) { @Override public boolean isValidateRoot() { return false; } }; contentPane.add(scrollPane, treeConstraints); final AbstractAction exportAction = new AbstractAction( TextUtils.getText("plugins/TimeManagement.xml_Export")) { /** * */ private static final long serialVersionUID = 1L; public void actionPerformed(final ActionEvent arg0) { exportSelectedRowsAndClose(); } }; final JButton exportButton = new JButton(exportAction); final AbstractAction replaceAllAction = new AbstractAction( TextUtils.getText("plugins/TimeManagement.xml_Replace_All")) { /** * */ private static final long serialVersionUID = 1L; public void actionPerformed(final ActionEvent arg0) { replace(new ReplaceAllInfo()); } }; final JButton replaceAllButton = new JButton(replaceAllAction); final AbstractAction replaceSelectedAction = new AbstractAction( TextUtils.getText("plugins/TimeManagement.xml_Replace_Selected")) { /** * */ private static final long serialVersionUID = 1L; public void actionPerformed(final ActionEvent arg0) { replace(new ReplaceSelectedInfo()); } }; final JButton replaceSelectedButton = new JButton(replaceSelectedAction); final AbstractAction gotoAction = new AbstractAction(TextUtils.getText("plugins/TimeManagement.xml_Goto")) { /** * */ private static final long serialVersionUID = 1L; public void actionPerformed(final ActionEvent arg0) { selectSelectedRows(); } }; final JButton gotoButton = new JButton(gotoAction); final AbstractAction disposeAction = new AbstractAction( TextUtils.getText(PLUGINS_TIME_MANAGEMENT_XML_CLOSE)) { /** * */ private static final long serialVersionUID = 1L; public void actionPerformed(final ActionEvent arg0) { disposeDialog(); } }; final JButton cancelButton = new JButton(disposeAction); /* Initial State */ gotoAction.setEnabled(false); exportAction.setEnabled(false); replaceSelectedAction.setEnabled(false); final Box bar = Box.createHorizontalBox(); bar.add(Box.createHorizontalGlue()); bar.add(cancelButton); bar.add(exportButton); bar.add(replaceAllButton); bar.add(replaceSelectedButton); bar.add(gotoButton); bar.add(Box.createHorizontalGlue()); layoutConstraints.gridy++; contentPane.add(/* new JScrollPane */(bar), layoutConstraints); final JMenuBar menuBar = new JMenuBar(); final JMenu menu = new JMenu(TextUtils.getText("plugins/TimeManagement.xml_menu_actions")); final AbstractAction[] actionList = new AbstractAction[] { gotoAction, replaceSelectedAction, replaceAllAction, exportAction, disposeAction }; for (int i = 0; i < actionList.length; i++) { final AbstractAction action = actionList[i]; final JMenuItem item = menu.add(action); item.setIcon(new BlindIcon(UIBuilder.ICON_SIZE)); } menuBar.add(menu); dialog.setJMenuBar(menuBar); final ListSelectionModel rowSM = timeTable.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(final ListSelectionEvent e) { if (e.getValueIsAdjusting()) { return; } final ListSelectionModel lsm = (ListSelectionModel) e.getSource(); final boolean enable = !(lsm.isSelectionEmpty()); replaceSelectedAction.setEnabled(enable); gotoAction.setEnabled(enable); exportAction.setEnabled(enable); } }); rowSM.addListSelectionListener(new ListSelectionListener() { String getNodeText(final NodeModel node) { return TextController.getController().getShortText(node) + ((node.isRoot()) ? "" : (" <- " + getNodeText(node.getParentNode()))); } public void valueChanged(final ListSelectionEvent e) { if (e.getValueIsAdjusting()) { return; } final ListSelectionModel lsm = (ListSelectionModel) e.getSource(); if (lsm.isSelectionEmpty()) { mTreeLabel.setText(""); return; } final int selectedRow = lsm.getLeadSelectionIndex(); final NodeModel mindMapNode = getMindMapNode(selectedRow); mTreeLabel.setText(getNodeText(mindMapNode)); } }); final String marshalled = ResourceController.getResourceController() .getProperty(NodeList.WINDOW_PREFERENCE_STORAGE_PROPERTY); final WindowConfigurationStorage result = TimeWindowConfigurationStorage.decorateDialog(marshalled, dialog); final WindowConfigurationStorage storage = result; if (storage != null) { timeTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); int column = 0; for (final TimeWindowColumnSetting setting : ((TimeWindowConfigurationStorage) storage) .getListTimeWindowColumnSettingList()) { timeTable.getColumnModel().getColumn(column).setPreferredWidth(setting.getColumnWidth()); sorter.setSortingStatus(column, setting.getColumnSorting()); column++; } } mFlatNodeTableFilterModel.setFilter((String) mFilterTextSearchField.getSelectedItem(), matchCase.isSelected(), useRegexInFind.isSelected()); dialog.setVisible(true); }
From source file:com.lottery.gui.MainLotteryForm.java
private void btnAddNumberActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddNumberActionPerformed try {//from w w w. jav a2 s.co m Integer number = Integer.parseInt(inputNumberTf.getText()); if (inputNumbers.contains(number)) { JOptionPane.showMessageDialog(this, "Number has already existed!"); return; } if (number > LotteryUtils.MAX_BALL_VALUE || number < LotteryUtils.MIN_BALL_VALUE) { JOptionPane.showMessageDialog(this, "Invalid range (" + LotteryUtils.MIN_BALL_VALUE + " - " + LotteryUtils.MAX_BALL_VALUE + ")!"); return; } JLabel numberLbl = new JLabel(number + ""); numberLbl.setOpaque(true); //numberLbl.setMinimumSize(new Dimension(100, 100)); // numberLbl.setPreferredSize(new Dimension(400, 100)); // numberLbl.setBackground(Color.white); numberLbl.setForeground(Color.red); setFont(numberLbl.getFont().deriveFont(150f)); numberLbl.setFont(new Font("Serif", Font.PLAIN, 30)); int numberOfInput = inputNumbers.size(); int row = numberOfInput / NO_NUMBER_PER_ROW; int col = numberOfInput % NO_NUMBER_PER_ROW; c.fill = GridBagConstraints.HORIZONTAL; c.gridx = col; c.gridy = row; c.weightx = 0.5; ballNumbersPanel.add(numberLbl, c); lbNumbers.add(numberLbl); inputNumbers.add(number); ballNumbersPanel.revalidate(); ballNumbersPanel.repaint(); inputNumberTf.setText(""); inputNumberTf.requestFocusInWindow(); // // check if has winner // Date today = LotteryUtils.getNextDate(new Date()); // if (dbTicketTables.isEmpty()) { // dbTicketTables = ticketTableService.getByDate(today); // } totalDrawedNumbers++; checkCanAddNumber(); if (inputNumbers.size() < LotteryUtils.MAX_BALLS_PER_LINE) { return; } winTicketTables.addAll(LotteryUtils.getWinnerByLine(dbTicketTables, inputNumbers)); if (winTicketTables.size() > 0) { // update table list view refreshWinnerTable(); // JOptionPane.showMessageDialog(this, "Number of winner: " + winTicketTables.size()); } // check if has full table, then stop game if (totalDrawedNumbers >= (LotteryUtils.MAX_BALLS_PER_LINE * LotteryUtils.NO_LINES_PER_TABLE)) { Iterator<TicketTable> iter = winTicketTables.iterator(); while (iter.hasNext()) { TicketTable tmp = iter.next(); if (tmp.getWinType() == TicketTable.FULL_TABLE) { JOptionPane.showMessageDialog(this, "Got winner with full table!"); // save draw results, update ticket_table winner DrawResult drawResult = new DrawResult(); drawResult.setDrawDate(LotteryUtils.getDate(ftfDrawDate.getText().trim())); drawResult.setDrawBalls(StringUtils.join(inputNumbers, LotteryUtils.BALLS_SEPARATOR)); drawResult.setRound(Byte.parseByte((String) cbbRound.getSelectedItem())); drawResultService.updateWinner(drawResult, winTicketTables); restartGame(); return; } } } } catch (NumberFormatException ex) { LOGGER.error("Invalid number!: ", ex); JOptionPane.showMessageDialog(this, "Invalid number!"); } catch (ParseException ex) { LOGGER.error("Cant parse date", ex); JOptionPane.showMessageDialog(this, "Cant save result!"); } }
From source file:net.sf.jabref.gui.FindUnlinkedFilesDialog.java
/** * Initializes the layout for the visible components in this menu. A * {@link GridBagLayout} is used./*from w w w . ja v a 2 s . c om*/ */ private void initLayout() { GridBagLayout gbl = new GridBagLayout(); panelDirectory.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), Localization.lang("Select directory"))); panelFiles.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), Localization.lang("Select files"))); panelEntryTypesSelection.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), Localization.lang("BibTeX entry creation"))); Insets basicInsets = new Insets(6, 6, 6, 6); Insets smallInsets = new Insets(3, 2, 3, 1); Insets noInsets = new Insets(0, 0, 0, 0); // x, y, w, h, wx,wy,ix,iy FindUnlinkedFilesDialog.addComponent(gbl, panelSearchArea, buttonScan, GridBagConstraints.HORIZONTAL, GridBagConstraints.EAST, noInsets, 0, 1, 1, 1, 1, 1, 40, 10); FindUnlinkedFilesDialog.addComponent(gbl, panelSearchArea, labelSearchingDirectoryInfo, GridBagConstraints.HORIZONTAL, GridBagConstraints.EAST, noInsets, 0, 2, 1, 1, 0, 0, 0, 0); FindUnlinkedFilesDialog.addComponent(gbl, panelSearchArea, progressBarSearching, GridBagConstraints.HORIZONTAL, GridBagConstraints.EAST, noInsets, 0, 3, 1, 1, 0, 0, 0, 0); FindUnlinkedFilesDialog.addComponent(gbl, panelDirectory, labelDirectoryDescription, null, GridBagConstraints.WEST, new Insets(6, 6, 0, 6), 0, 0, 3, 1, 0, 0, 0, 0); FindUnlinkedFilesDialog.addComponent(gbl, panelDirectory, textfieldDirectoryPath, GridBagConstraints.HORIZONTAL, null, basicInsets, 0, 1, 2, 1, 1, 1, 0, 0); FindUnlinkedFilesDialog.addComponent(gbl, panelDirectory, buttonBrowse, GridBagConstraints.HORIZONTAL, GridBagConstraints.EAST, basicInsets, 2, 1, 1, 1, 0, 0, 0, 0); FindUnlinkedFilesDialog.addComponent(gbl, panelDirectory, labelFileTypesDescription, GridBagConstraints.NONE, GridBagConstraints.WEST, new Insets(18, 6, 18, 3), 0, 3, 1, 1, 0, 0, 0, 0); FindUnlinkedFilesDialog.addComponent(gbl, panelDirectory, comboBoxFileTypeSelection, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST, new Insets(18, 3, 18, 6), 1, 3, 1, 1, 1, 0, 0, 0); FindUnlinkedFilesDialog.addComponent(gbl, panelDirectory, panelSearchArea, GridBagConstraints.HORIZONTAL, GridBagConstraints.EAST, new Insets(18, 6, 18, 6), 2, 3, 1, 1, 0, 0, 0, 0); FindUnlinkedFilesDialog.addComponent(gbl, panelFiles, labelFilesDescription, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST, new Insets(6, 6, 0, 6), 0, 0, 1, 1, 0, 0, 0, 0); FindUnlinkedFilesDialog.addComponent(gbl, panelFiles, scrollpaneTree, GridBagConstraints.BOTH, GridBagConstraints.CENTER, basicInsets, 0, 1, 1, 1, 1, 1, 0, 0); FindUnlinkedFilesDialog.addComponent(gbl, panelFiles, panelOptions, GridBagConstraints.NONE, GridBagConstraints.NORTHEAST, basicInsets, 1, 1, 1, 1, 0, 0, 0, 0); FindUnlinkedFilesDialog.addComponent(gbl, panelOptions, buttonOptionSelectAll, GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTH, noInsets, 0, 0, 1, 1, 1, 0, 0, 0); FindUnlinkedFilesDialog.addComponent(gbl, panelOptions, buttonOptionUnselectAll, GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTH, noInsets, 0, 1, 1, 1, 0, 0, 0, 0); FindUnlinkedFilesDialog.addComponent(gbl, panelOptions, buttonOptionExpandAll, GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTH, new Insets(6, 0, 0, 0), 0, 2, 1, 1, 0, 0, 0, 0); FindUnlinkedFilesDialog.addComponent(gbl, panelOptions, buttonOptionCollapseAll, GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTH, noInsets, 0, 3, 1, 1, 0, 0, 0, 0); FindUnlinkedFilesDialog.addComponent(gbl, panelEntryTypesSelection, labelEntryTypeDescription, GridBagConstraints.NONE, GridBagConstraints.WEST, basicInsets, 0, 0, 1, 1, 0, 0, 0, 0); FindUnlinkedFilesDialog.addComponent(gbl, panelEntryTypesSelection, comboBoxEntryTypeSelection, GridBagConstraints.NONE, GridBagConstraints.WEST, basicInsets, 1, 0, 1, 1, 1, 0, 0, 0); FindUnlinkedFilesDialog.addComponent(gbl, panelEntryTypesSelection, checkboxCreateKeywords, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST, basicInsets, 0, 1, 2, 1, 0, 0, 0, 0); FindUnlinkedFilesDialog.addComponent(gbl, panelImportArea, labelImportingInfo, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER, new Insets(6, 6, 0, 6), 0, 1, 1, 1, 1, 0, 0, 0); FindUnlinkedFilesDialog.addComponent(gbl, panelImportArea, progressBarImporting, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER, new Insets(0, 6, 6, 6), 0, 2, 1, 1, 1, 0, 0, 0); FindUnlinkedFilesDialog.addComponent(gbl, panelButtons, panelImportArea, GridBagConstraints.NONE, GridBagConstraints.EAST, smallInsets, 1, 0, 1, 1, 0, 0, 0, 0); FindUnlinkedFilesDialog.addComponent(gbl, getContentPane(), panelDirectory, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER, basicInsets, 0, 0, 1, 1, 0, 0, 0, 0); FindUnlinkedFilesDialog.addComponent(gbl, getContentPane(), panelFiles, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST, new Insets(12, 6, 2, 2), 0, 1, 1, 1, 1, 1, 0, 0); FindUnlinkedFilesDialog.addComponent(gbl, getContentPane(), panelEntryTypesSelection, GridBagConstraints.HORIZONTAL, GridBagConstraints.SOUTHWEST, new Insets(12, 6, 2, 2), 0, 2, 1, 1, 0, 0, 0, 0); FindUnlinkedFilesDialog.addComponent(gbl, getContentPane(), panelButtons, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER, new Insets(10, 6, 10, 6), 0, 3, 1, 1, 0, 0, 0, 0); ButtonBarBuilder bb = new ButtonBarBuilder(); bb.addGlue(); bb.addButton(buttonApply); bb.addButton(buttonClose); bb.addGlue(); bb.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); panelImportArea.add(bb.getPanel(), GridBagConstraints.NONE); pack(); }
From source file:com.microsoft.azure.hdinsight.spark.ui.SparkSubmissionContentPanel.java
private void addReferencedFilesLineItem() { JLabel commandLineArgs = new JLabel("Referenced Files"); commandLineArgs.setToolTipText(/* w w w . jav a 2 s.co m*/ "Files to be placed in executor working directory. The path needs to be a Azure Blob Storage Path (path started with wasb://); Multiple paths should be split by semicolon (;) "); add(commandLineArgs, new GridBagConstraints(0, ++displayLayoutCurrentRow, 1, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(margin, margin, 0, 0), 0, 0)); referencedFilesTextField = new JTextField(); referencedFilesTextField.setToolTipText( "Files to be placed in executor working directory. The path needs to be a Azure Blob Storage Path (path started with wasb://); Multiple paths should be split by semicolon (;) "); add(referencedFilesTextField, new GridBagConstraints(1, displayLayoutCurrentRow, 0, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(margin, margin, 0, margin), 0, 0)); }