List of usage examples for javax.swing Box createVerticalGlue
public static Component createVerticalGlue()
From source file:org.streamspinner.harmonica.application.CQGraphTerminal.java
private JPanel getJPanel12() { if (jPanel12 != null) return jPanel12; jPanel12 = new JPanel(); jPanel12.setMaximumSize(new Dimension(60, Short.MAX_VALUE)); jPanel12.setPreferredSize(new Dimension(60, 150)); jPanel12.setLayout(new BoxLayout(jPanel12, BoxLayout.PAGE_AXIS)); jPanel12.add(Box.createVerticalGlue()); jPanel12.add(getJButton());// w ww .j a va 2 s.co m jPanel12.add(Box.createVerticalGlue()); jPanel12.add(getJButton1()); jPanel12.add(Box.createVerticalGlue()); return jPanel12; }
From source file:org.jdal.swing.Selector.java
/** * Initialize component after construction. *///from ww w. ja v a 2 s.c o m @PostConstruct public void init() { if (availableList == null) { availableList = new JList<T>(available); } else { availableList.setModel(available); } if (selectedList == null) { selectedList = new JList<T>(selected); } else { selectedList.setModel(selected); } availableSearch.setVisible(showSearchFields); selectedSearch.setVisible(showSearchFields); JButton addButton = new JButton(new AddSelectedAction()); JButton removeButton = new JButton(new RemoveSelectedAction()); addButton.setMinimumSize(new Dimension(buttonWidth, buttonHeight)); removeButton.setMinimumSize(new Dimension(buttonWidth, buttonHeight)); JScrollPane availableScroll = new JScrollPane(availableList); JScrollPane selectedScroll = new JScrollPane(selectedList); availableScroll.setPreferredSize(new Dimension(listWidth, listheight)); selectedScroll.setPreferredSize(new Dimension(listWidth, listheight)); availableScroll.setMinimumSize(new Dimension(listWidth, listheight)); selectedScroll.setMinimumSize(new Dimension(listWidth, listheight)); // test message source if (messageSource == null) { messageSource = new ResourceBundleMessageSource(); ((ResourceBundleMessageSource) messageSource).setBasename("i18n.jdal"); } MessageSourceAccessor msa = new MessageSourceAccessor(messageSource); BoxFormBuilder fb = new BoxFormBuilder(); fb.row(Short.MAX_VALUE); fb.startBox(); fb.row(); fb.add(availableSearch); fb.row(); fb.add(FormUtils.newLabelForBox(msa.getMessage("Selector.available"))); fb.row(Short.MAX_VALUE); fb.add(availableScroll); fb.endBox(); fb.startBox(); fb.row(Short.MAX_VALUE); fb.add(Box.createVerticalGlue()); fb.row(buttonHeight); fb.add(removeButton); fb.row(Short.MAX_VALUE); fb.add(Box.createVerticalGlue()); fb.endBox(); fb.setMaxWidth(buttonWidth); fb.startBox(); fb.row(Short.MAX_VALUE); fb.add(Box.createVerticalGlue()); fb.row(buttonHeight); fb.add(addButton); fb.row(Short.MAX_VALUE); fb.add(Box.createVerticalGlue()); fb.endBox(); fb.setMaxWidth(buttonWidth); fb.startBox(); fb.row(); fb.add(selectedSearch); fb.row(); fb.add(FormUtils.newLabelForBox(msa.getMessage("Selector.selected"))); fb.row(Short.MAX_VALUE); fb.add(selectedScroll); fb.endBox(); setLayout(new BorderLayout()); add(fb.getForm(), BorderLayout.CENTER); }
From source file:com.game.ui.views.WeaponEditorPanel.java
public void doGui() { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JLabel noteLbl = new JLabel( "<html><div style='width : 500px;'>Pls select a value to choose an Weapon or you can create a new " + "Weapon entity below. Once selected a weapon, its' details will be available below</div></html>"); noteLbl.setAlignmentX(0);/*from w w w.ja v a 2 s. c o m*/ add(noteLbl); DefaultComboBoxModel model = new DefaultComboBoxModel(); for (Item item : GameBean.weaponDetails) { if (item instanceof Weapon) { model.addElement(((Weapon) item).getName()); } } comboBox = new JComboBox(model); comboBox.setSelectedIndex(-1); comboBox.setMaximumSize(new Dimension(100, 30)); comboBox.setAlignmentX(0); comboBox.setActionCommand("dropDown"); comboBox.addActionListener(this); add(Box.createVerticalStrut(10)); add(comboBox); add(Box.createVerticalStrut(10)); JPanel panel1 = new JPanel(); panel1.setAlignmentX(0); panel1.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); panel1.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(5, 5, 5, 5); c.weightx = 1; c.weighty = 1; c.gridwidth = 2; JLabel weaponDtsLbl = new JLabel("Weapon Details : "); weaponDtsLbl.setFont(new Font("Times New Roman", Font.BOLD, 15)); panel1.add(weaponDtsLbl, c); c.gridwidth = 1; c.gridy = 1; JLabel nameLbl = new JLabel("Name : "); panel1.add(nameLbl, c); c.gridx = 1; JTextField name = new JTextField(""); name.setColumns(20); panel1.add(name, c); c.gridx = 0; c.gridy = 2; JLabel weaponTypeLbl = new JLabel("Weapon Type : "); panel1.add(weaponTypeLbl, c); c.gridx = 1; JComboBox weaponType = new JComboBox(Configuration.weaponTypes); weaponType.setSelectedIndex(0); weaponType.setPreferredSize(name.getPreferredSize()); System.out.println(name.getPreferredSize()); panel1.add(weaponType, c); c.gridx = 0; c.gridy = 3; JLabel attackRangeLbl = new JLabel("Attack Range : "); panel1.add(attackRangeLbl, c); c.gridx = 1; JTextField attackRange = new JTextField(""); attackRange.setColumns(20); panel1.add(attackRange, c); c.gridx = 0; c.gridy = 4; JLabel attackPtsLbl = new JLabel("Attack Points : "); panel1.add(attackPtsLbl, c); c.gridx = 1; JTextField attackPts = new JTextField(""); attackPts.setColumns(20); panel1.add(attackPts, c); c.gridx = 0; c.gridy = 5; c.gridwidth = 2; JButton submit = new JButton("Save"); submit.addActionListener(this); submit.setActionCommand("button"); panel1.add(submit, c); c.gridx = 0; c.gridy = 6; c.gridwidth = 2; c.weighty = 0; c.weightx = 1; validationMess = new JLabel("Pls enter all the fields or pls choose a weapon from the drop down"); validationMess.setForeground(Color.red); validationMess.setVisible(false); panel1.add(validationMess, c); // c.fill = GridBagConstraints.BOTH; // c.gridy = 7; // c.weightx = 1; // c.weighty = 1; // panel1.add(new JLabel(""), c); panel1.setBorder(LineBorder.createGrayLineBorder()); add(panel1); add(Box.createVerticalGlue()); }
From source file:com.game.ui.views.CharachterEditorPanel.java
public void doGui() { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JLabel noteLbl = new JLabel("Pls select a value to choose an enemy or you can create a new " + "Enemy entity below. Once selected an Enemy character, its' details will be available below"); noteLbl.setAlignmentX(0);/*from w ww .j a v a 2 s. c o m*/ // noteLbl.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); add(noteLbl); DefaultComboBoxModel model = new DefaultComboBoxModel(); for (GameCharacter character : GameBean.enemyDetails) { System.out.println(character.getName()); model.addElement(character.getName()); } comboBox = new JComboBox(model); comboBox.setSelectedIndex(-1); comboBox.setMaximumSize(new Dimension(100, 30)); comboBox.setAlignmentX(0); comboBox.setActionCommand("dropDown"); comboBox.addActionListener(this); add(Box.createVerticalStrut(10)); add(comboBox); add(Box.createVerticalStrut(10)); JPanel panel1 = new JPanel(); panel1.setAlignmentX(0); panel1.setBorder(LineBorder.createGrayLineBorder()); panel1.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(5, 5, 5, 5); c.weightx = 1; c.weighty = 1; c.gridwidth = 2; JLabel enemyDtlLbl = new JLabel("Enemy Character Details : "); enemyDtlLbl.setFont(new Font("Times New Roman", Font.BOLD, 15)); panel1.add(enemyDtlLbl, c); c.gridwidth = 1; c.gridy = 1; JLabel nameLbl = new JLabel("Name : "); panel1.add(nameLbl, c); c.gridx = 1; JTextField name = new JTextField(""); name.setColumns(20); panel1.add(name, c); c.gridx = 0; c.gridy = 2; JLabel imageLbl = new JLabel("Image Path : "); panel1.add(imageLbl, c); c.gridx = 1; JTextField image = new JTextField(""); image.setColumns(20); panel1.add(image, c); c.gridx = 0; c.gridy = 3; JLabel healthLbl = new JLabel("Health Pts : "); panel1.add(healthLbl, c); c.gridx = 1; JTextField health = new JTextField(""); health.setColumns(20); panel1.add(health, c); c.gridx = 0; c.gridy = 4; JLabel attackPtsLbl = new JLabel("Attack Points : "); panel1.add(attackPtsLbl, c); c.gridx = 1; JTextField attackPts = new JTextField(""); attackPts.setColumns(20); panel1.add(attackPts, c); c.gridx = 0; c.gridy = 5; JLabel armoursPtsLbl = new JLabel("Armour Points : "); panel1.add(armoursPtsLbl, c); c.gridx = 1; JTextField armourPts = new JTextField(""); armourPts.setColumns(20); panel1.add(armourPts, c); c.gridx = 0; c.gridy = 6; JLabel attackRngeLbl = new JLabel("Attack Range : "); panel1.add(attackRngeLbl, c); c.gridx = 1; JTextField attackRnge = new JTextField(""); attackRnge.setColumns(20); panel1.add(attackRnge, c); c.gridx = 0; c.gridy = 7; JLabel movementLbl = new JLabel("Movement : "); panel1.add(movementLbl, c); c.gridx = 1; JTextField movement = new JTextField(""); movement.setColumns(20); panel1.add(movement, c); c.gridx = 0; c.gridy = 8; c.gridwidth = 2; JButton submit = new JButton("Save"); submit.addActionListener(this); submit.setActionCommand("button"); panel1.add(submit, c); add(panel1); c.gridx = 0; c.gridy = 9; JLabel validationMess = new JLabel("Pls enter all the fields or pls choose a character from the drop down"); validationMess.setForeground(Color.red); validationMess.setVisible(false); add(validationMess, c); add(Box.createVerticalGlue()); }
From source file:com.idealista.solrmeter.view.statistic.CacheHistoryPanel.java
/** * Creates the left panel, with the combo boxes to select wether to see hit ratio * or specific cache data, and if specific cache data is selected, will also show * the combo box to select the cache and the cumulative information * @return//from w ww .j av a 2s . c om */ private Component createLeftPanel() { JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.gridx = 0; constraints.gridy = 0; constraints.weighty = 0; constraints.fill = GridBagConstraints.BOTH; constraints.insets = new Insets(1, 1, 1, 1); for (Component component : this.createControlPanel()) { panel.add(component, constraints); constraints.gridy++; } cumulativeDataPanel = this.createCumulativeDataPanel(); panel.add(cumulativeDataPanel, constraints); constraints.gridy++; constraints.weighty = 2.0; panel.add(Box.createVerticalGlue(), constraints); panel.setMaximumSize(new Dimension(100, Integer.MAX_VALUE)); return panel; }
From source file:pcgen.gui2.tabs.bio.BiographyInfoPane.java
private void initComponents() { setLayout(new GridBagLayout()); Box vbox = Box.createVerticalBox(); allButton.setText(LanguageBundle.getString("in_all")); //$NON-NLS-1$ allButton.setActionCommand(ALL_COMMAND); noneButton.setText(LanguageBundle.getString("in_none")); //$NON-NLS-1$ noneButton.setActionCommand(NONE_COMMAND); Box hbox = Box.createHorizontalBox(); hbox.add(new JLabel(LanguageBundle.getString("in_descCheckItem"))); //$NON-NLS-1$ hbox.add(Box.createRigidArea(new Dimension(5, 0))); hbox.add(allButton);// w w w .j a va 2 s . c om hbox.add(Box.createRigidArea(new Dimension(3, 0))); hbox.add(noneButton); vbox.add(hbox); itemsPanel.setLayout(new GridBagLayout()); itemsPanel.setBorder(new EmptyBorder(8, 5, 8, 5)); vbox.add(Box.createVerticalStrut(10)); detailsScroll = new JScrollPane(itemsPanel); detailsScroll.setPreferredSize(detailsScroll.getMaximumSize()); detailsScroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); detailsScroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); detailsScroll.setMinimumSize(new Dimension(600, 0)); vbox.add(detailsScroll); vbox.add(Box.createVerticalStrut(10)); hbox = Box.createHorizontalBox(); hbox.add(Box.createHorizontalGlue()); addCustomItemButton = new JButton(); hbox.add(addCustomItemButton); hbox.add(Box.createHorizontalGlue()); vbox.add(hbox); vbox.add(Box.createVerticalGlue()); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.NORTHWEST; gbc.weightx = 1; gbc.fill = GridBagConstraints.VERTICAL; gbc.weighty = 1; gbc.insets = new Insets(5, 5, 5, 5); add(vbox, gbc); }
From source file:com.actelion.research.spiritapp.ui.audit.RecentChangesDlg.java
public RecentChangesDlg(String userId) { super(UIUtils.getMainFrame(), "Recent Changes"); if (userId == null) { userTextField.setText(""); userTextField.setEnabled(true);//from w w w .j a v a2 s.co m } else { userTextField.setText(userId.length() == 0 ? "NA" : userId); userTextField.setEnabled(false); } userTextField.setTextWhenEmpty("UserId"); fromTextField.setText(FormatterUtils.formatDate(DateUtils.addDays(new Date(), -3))); toTextField.setText(FormatterUtils.formatDate(DateUtils.addDays(new Date(), 1))); //RevisionPanel JButton filterButton = new JIconButton(IconType.SEARCH, "Search"); filterButton.addActionListener(e -> loadRevisions()); userTextField.addActionListener(e -> loadRevisions()); //fromTextField.addActionListener(e->loadRevisions()); //toTextField.addActionListener(e->loadRevisions()); studyComboBox.addActionListener(e -> loadRevisions()); byFieldCheckbox.addActionListener(e -> revisionPanel.setSingular(byFieldCheckbox.isSelected())); byFieldCheckbox.setVisible(SpiritProperties.getInstance().isAdvancedMode()); exportChangeEventsAction.setParentDlg(this); JIconButton exportChangeEventsButton = new JIconButton(IconType.PDF, "Export Change Events...", exportChangeEventsAction); JPanel actionPanel = UIUtils.createHorizontalBox(Box.createHorizontalGlue(), exportChangeEventsButton); JPanel revisionQueryPanel = UIUtils.createTitleBox("Filters", UIUtils.createVerticalBox( UIUtils.createTable(4, new JLabel("From: "), fromTextField, new JLabel(" To: "), toTextField), UIUtils.createHorizontalBox(byFieldCheckbox, Box.createHorizontalGlue()), Box.createVerticalStrut(10), new JSeparator(JSeparator.HORIZONTAL), UIUtils.createHorizontalBox(studyCheckBox, sampleCheckBox, locationCheckBox, resultCheckBox, Box.createHorizontalGlue()), UIUtils.createBox(BorderFactory.createEmptyBorder(10, 10, 10, 0), UIUtils.createTable(2, new JLabel("StudyId: "), studyComboBox/*, new JLabel("UserId: "), userTextField*/)), new JSeparator(JSeparator.HORIZONTAL), UIUtils.createHorizontalBox(adminChanges, Box.createHorizontalGlue()), Box.createVerticalStrut(20), new JSeparator(JSeparator.HORIZONTAL), UIUtils.createHorizontalBox(Box.createHorizontalGlue(), filterButton), Box.createVerticalGlue())); getRootPane().setDefaultButton(filterButton); if (!SpiritProperties.getInstance().isChecked(PropertyKey.SYSTEM_RESULT)) { resultCheckBox.setVisible(false); resultCheckBox.setSelected(false); } //ContentPane setContentPane(UIUtils.createBox(revisionPanel, null, actionPanel, revisionQueryPanel, null)); UIUtils.adaptSize(this, 1200, 800); setVisible(true); }
From source file:gg.pistol.sweeper.gui.component.DecoratedPanel.java
private void addSideImage() { JPanel panel = createVerticalPanel(); panel.add(new JLabel(sideImage)); panel.add(Box.createVerticalGlue()); if (ComponentOrientation.getOrientation(i18n.getLocale()).isLeftToRight()) { panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, border)); add(panel, BorderLayout.WEST); } else {//from w w w . ja v a 2s . co m panel.setBorder(BorderFactory.createEmptyBorder(0, border, 0, 0)); add(panel, BorderLayout.EAST); } }
From source file:com.game.ui.views.ItemPanel.java
public void doCommonStuffForContent() { JPanel panel1 = new JPanel(); panel1.setAlignmentX(0);// w w w . ja v a 2 s . c o m panel1.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); panel1.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.NORTHWEST; c.insets = new Insets(5, 5, 5, 5); c.weightx = 1; c.weighty = 0.2; c.gridwidth = 2; JLabel dtlLbl = new JLabel(type + "Details : "); dtlLbl.setFont(new Font("Times New Roman", Font.BOLD, 15)); panel1.add(dtlLbl, c); c.gridwidth = 1; c.gridy = 1; JLabel nameLbl = new JLabel("Name : "); panel1.add(nameLbl, c); c.gridx = 1; JTextField name = new JTextField(""); name.setColumns(20); panel1.add(name, c); if (ringPanel) { createComponentsForRing(panel1, c); } else if (armourPanel) { createComponentsForArmour(panel1, c); } else if (potionPanel) { createComponentsForPotion(panel1, c); } else if (treasurePanel) { createComponentsForTreasure(panel1, c); } c.gridx = 0; c.gridy = c.gridy + 1; c.gridwidth = 2; JButton submit = new JButton("Save"); submit.addActionListener(this); submit.setActionCommand("button"); panel1.add(submit, c); c.gridx = 0; c.gridy = c.gridy + 1; c.gridwidth = 2; c.weighty = 0; c.weightx = 1; validationMess = new JLabel("Pls enter all the fields or pls choose a " + type + " from the drop down"); validationMess.setForeground(Color.red); validationMess.setVisible(false); panel1.add(validationMess, c); c.gridy++; c.weighty = 1; c.weightx = 1; panel1.add(new JPanel(), c); panel1.setBorder(LineBorder.createGrayLineBorder()); add(panel1); add(Box.createVerticalGlue()); }
From source file:gate.creole.kea.CorpusImporter.java
protected void initGUIComponents() { setLayout(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.gridy = 0;// w ww. j a v a 2 s . c o m constraints.gridx = GridBagConstraints.RELATIVE; constraints.weightx = 0; constraints.weighty = 0; constraints.fill = GridBagConstraints.BOTH; JPanel inputPanel = new JPanel(new GridBagLayout()); inputPanel.setBorder(BorderFactory.createTitledBorder("Input")); GridBagConstraints constraints2 = new GridBagConstraints(); constraints2.gridy = 0; constraints2.gridx = GridBagConstraints.RELATIVE; constraints2.weighty = 0; constraints2.weightx = 0; constraints2.fill = GridBagConstraints.BOTH; constraints2.insets = new Insets(2, 2, 2, 2); JLabel label = new JLabel("Source directory:"); inputPanel.add(label, constraints2); sourceDirTField = new JTextField(30); inputPanel.add(sourceDirTField, constraints2); JButton openButton = new JButton(new SelectDirectoryAction()); inputPanel.add(openButton, constraints2); constraints2.gridy = 1; label = new JLabel("Extension for text files:"); inputPanel.add(label, constraints2); constraints2.gridwidth = 2; textExtensionTField = new JTextField(".txt"); inputPanel.add(textExtensionTField, constraints2); constraints2.gridwidth = 1; constraints2.gridy = 2; label = new JLabel("Extension for keyphrase files:"); inputPanel.add(label, constraints2); constraints2.gridwidth = 2; keyExtensionTField = new JTextField(".key"); inputPanel.add(keyExtensionTField, constraints2); constraints2.gridwidth = 1; constraints2.gridy = 3; label = new JLabel("Encoding for input files:"); inputPanel.add(label, constraints2); constraints2.gridwidth = 2; encodingTField = new JTextField(""); inputPanel.add(encodingTField, constraints2); constraints2.gridwidth = 1; add(inputPanel, constraints); constraints.weightx = 1; add(Box.createHorizontalGlue(), constraints); constraints.weightx = 0; JPanel outputPanel = new JPanel(); outputPanel.setLayout(new GridBagLayout()); outputPanel.setBorder(BorderFactory.createTitledBorder("Output")); constraints2.gridy = 0; label = new JLabel("Corpus name:"); outputPanel.add(label, constraints2); constraints2.weightx = 1; corpusNameTField = new JTextField("KEA Corpus"); constraints2.weightx = 0; outputPanel.add(corpusNameTField, constraints2); constraints2.gridy = 1; label = new JLabel("Output annotation set:"); outputPanel.add(label, constraints2); constraints2.weightx = 1; annotationSetTField = new JTextField("Key"); constraints2.weightx = 0; outputPanel.add(annotationSetTField, constraints2); constraints2.gridy = 2; label = new JLabel("Keyphrase annotation type:"); outputPanel.add(label, constraints2); constraints2.weightx = 1; annotationTypeTField = new JTextField("Keyphrase"); constraints2.weightx = 0; outputPanel.add(annotationTypeTField, constraints2); constraints.gridy = 1; add(outputPanel, constraints); constraints.gridy = 2; constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; add(new JButton(new ImportCorpusAction()), constraints); constraints.gridy = 3; constraints.weighty = 1; add(Box.createVerticalGlue(), constraints); }