public HelpUI(Frame parent, String title) { sidebar = new Sidebar(); sidebar.setBorder(new EmptyBorder(10, 10, 10, 10)); infoView = new JTextPane(); Dimension d1 = sidebar.getPreferredSize(); infoView.setPreferredSize(new Dimension(d1.width * 3, d1.height - 5)); infoView.setEditable(false); MouseAdapter ma = new MouseAdapter() { @Override public void mouseClicked(MouseEvent me) { SidebarOption sopt = (SidebarOption) me.getComponent(); if (sel != null) { sel.setSelected(false); sel.repaint(); } sel = sopt; sel.setSelected(true); sel.repaint(); renderInfo(); } }; general = new SidebarOption("General Info", HELP_GENERAL_LOC); general.addMouseListener(ma); sidebar.add(general); sidebar.add(Box.createVerticalStrut(scy(10))); artifact = new SidebarOption("Artifacts", HELP_ARTIFACTS_LOC); artifact.addMouseListener(ma); sidebar.add(artifact); sidebar.add(Box.createVerticalStrut(scy(10))); net = new SidebarOption("Networking", HELP_NET_LOC); net.addMouseListener(ma); sidebar.add(net); sidebar.add(Box.createVerticalStrut(scy(10))); gpl = new SidebarOption("License", HELP_GPL_LOC); gpl.addMouseListener(ma); sidebar.add(gpl); general.setSelected(true); sel = general; sidebar.add(Box.createVerticalGlue()); add(BorderLayout.WEST, sidebar); add(BorderLayout.CENTER, new JScrollPane(infoView)); setResizable(false); pack(); setLocationRelativeTo(parent); setTitle(title); renderInfo(); }
/** * Creates the Factor definition subform * * @return - JPanel containing the Factor definition subform. */ private Container createTransposedView() { Box subformContainer = Box.createVerticalBox(); transposedSpreadsheetSubform = new TransposedSubForm( "spreadsheet data", FieldTypes.ROW, transposedSpreadsheetModel.getFields(), transposedSpreadsheetModel.getNumberOfRecords(), width, height, transposedSpreadsheetModel.getData(), transposedSpreadsheetModel.getSpreadsheet().getDataEntryEnv()); transposedSpreadsheetSubform.createGUI(); transposedSpreadsheetSubform.addPropertyChangeListener( "rowAdded", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent propertyChangeEvent) { updateInformation(); } }); subformContainer.add(Box.createVerticalStrut(15)); subformContainer.add(transposedSpreadsheetSubform); subformContainer.add(Box.createVerticalStrut(15)); return subformContainer; }
public void createGUI() { HUDTitleBar titlePanel = new HUDTitleBar(headerImage, headerImage); add(titlePanel, BorderLayout.NORTH); titlePanel.installListeners(); createProgressScreen(); JPanel exportOptionContainer = new JPanel(); exportOptionContainer.setLayout(new BoxLayout(exportOptionContainer, BoxLayout.PAGE_AXIS)); exportOptionContainer.add(createCompressionRateChoiceUI()); exportOptionContainer.add(Box.createVerticalStrut(20)); exportOptionContainer.add(createSelectOutputDirectoryUI()); exportOptionContainer.add(Box.createVerticalStrut(20)); exportOptionContainer.add(createCreateArchiveButtonUI()); swappableContainer.add(exportOptionContainer, BorderLayout.CENTER); add(swappableContainer, BorderLayout.CENTER); ((JComponent) getContentPane()).setBorder(new LineBorder(UIHelper.LIGHT_GREEN_COLOR, 2, true)); addWindowListener(this); pack(); setVisible(true); }
/** * Creates a dialog that is showing the histogram for the given node (if null one is selected for * you) */ private JPanel createNormalityTestDialog(Node selected) { DataSet dataSet = (DataSet) dataEditor.getSelectedDataModel(); QQPlot qqPlot = new QQPlot(dataSet, selected); NormalityTestEditorPanel editorPanel = new NormalityTestEditorPanel(qqPlot, dataSet); JTextArea display = new JTextArea( NormalityTests.runNormalityTests( dataSet, (ContinuousVariable) qqPlot.getSelectedVariable()), 20, 65); display.setEditable(false); editorPanel.addPropertyChangeListener(new NormalityTestListener(display)); Box box = Box.createHorizontalBox(); box.add(display); box.add(Box.createHorizontalStrut(3)); box.add(editorPanel); box.add(Box.createHorizontalStrut(5)); box.add(Box.createHorizontalGlue()); Box vBox = Box.createVerticalBox(); vBox.add(Box.createVerticalStrut(15)); vBox.add(box); vBox.add(Box.createVerticalStrut(5)); JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); panel.add(vBox, BorderLayout.CENTER); return panel; }
public DisplayUserDirectory() { GridBagLayout gbl = new GridBagLayout(); GridBagConstraints gbc = new GridBagConstraints(); setLayout(gbl); gbc.anchor = GridBagConstraints.NORTHWEST; gbc.fill = GridBagConstraints.HORIZONTAL; hmlabel.setForeground(Color.black); add(hmlabel, gbc); add(Box.createHorizontalStrut(10), gbc); gbc.gridwidth = GridBagConstraints.REMAINDER; add(hmdir, gbc); add(Box.createVerticalStrut(15), gbc); gbc.gridwidth = 1; vjlabel.setForeground(Color.black); add(vjlabel, gbc); add(Box.createHorizontalStrut(10), gbc); gbc.gridwidth = GridBagConstraints.REMAINDER; add(vjdir, gbc); add(Box.createVerticalStrut(0), gbc); gbc.gridwidth = 1; vjlabel2.setForeground(Color.black); add(vjlabel2, gbc); setBorder( new CompoundBorder( // i18n // BorderFactory.createTitledBorder(" User_Directories "), BorderFactory.createTitledBorder(Util.getAdmLabel("_admin_User_Directories")), BorderFactory.createEmptyBorder(10, 10, 10, 10))); }
@Inject public CheckoutPanel(BookInventory inventory, CreditCardService cardService, Logger logger) { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); this.logger = logger; this.cartTableModel = new CartTableModel(); final CheckoutInventoryTableModel inventoryModel = new CheckoutInventoryTableModel(inventory); inventoryModel.addTableModelListener( new TableModelListener() { public void tableChanged(TableModelEvent event) { if (inventoryModel.isLastColumn(event.getColumn())) { for (int i = event.getFirstRow(); i <= event.getLastRow(); i++) { addToCart(inventoryModel.decrementInventry(event.getFirstRow())); } } } }); this.add(new JScrollPane(new CheckoutInventoryTable(inventoryModel))); this.add(Box.createVerticalStrut(20)); this.add(new JScrollPane(new CartTable(cartTableModel))); this.add(Box.createVerticalStrut(20)); this.add(new PaymentPanel(cardService)); this.add(Box.createVerticalGlue()); this.setPreferredSize(new Dimension(600, 400)); }
private void setupUI() { mainPanel = new JPanel(); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); mainPanel.add(createCurrentDirectoryPanel()); mainPanel.add(Box.createVerticalStrut(10)); mainPanel.add(createLogLevelPanel()); mainPanel.add(Box.createVerticalStrut(10)); mainPanel.add(createStackTracePanel()); mainPanel.add(Box.createVerticalStrut(10)); mainPanel.add(createOptionsPanel()); mainPanel.add(Box.createVerticalStrut(10)); mainPanel.add(createCustomExecutorPanel()); mainPanel.add(Box.createVerticalStrut(10)); // add a panel that can be used to add custom things to the setup tab customPanelPlaceHolder = new JPanel(new BorderLayout()); mainPanel.add(customPanelPlaceHolder); // Glue alone doesn't work in this situation. This forces everything to the top. JPanel expandingPanel = new JPanel(new BorderLayout()); expandingPanel.add(Box.createVerticalGlue(), BorderLayout.CENTER); mainPanel.add(expandingPanel); mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); }
public DateTimeView(DateTime time) { super(); this.time = time; Font f = new Font("Monospaced", Font.BOLD, 13); Color c = new Color(44, 68, 152); month = new JLabel(strMonth(time.getMonthOfYear())); month.setFont(f); month.setForeground(c); year = new JLabel("" + time.getYear()); year.setFont(f); year.setForeground(c); day = new JLabel("" + time.getDayOfMonth()); day.setFont(new Font("Calibri", Font.BOLD, 26)); day.setForeground(new Color(126, 148, 227)); t = new JLabel(formatTime(time.getHourOfDay(), time.getMinuteOfHour())); t.setFont(f); t.setForeground(c); JPanel topPanel = new JPanel(); topPanel.setLayout(new FlowLayout()); topPanel.add(month); topPanel.add(year); this.setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); topPanel.setAlignmentX(Component.CENTER_ALIGNMENT); this.add(topPanel); this.add(Box.createVerticalStrut(3)); day.setAlignmentX(Component.CENTER_ALIGNMENT); this.add(day); t.setAlignmentX(Component.CENTER_ALIGNMENT); this.add(Box.createVerticalStrut(3)); this.add(t); this.setBorder(BorderFactory.createRaisedBevelBorder()); }
public void init() { makeMenus(); JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout(10, 10)); _controlPanel = new JPanel(); _controlPanel.setLayout(new BoxLayout(_controlPanel, BoxLayout.PAGE_AXIS)); _controlPanel.add(Box.createVerticalGlue()); _controlPanel.add(makeBlockPanels()); _controlPanel.add(searchDepthPanel(false)); _maxSpeedBox.addActionListener( (ActionEvent e) -> { getBoxData(); }); _autoRunPanel = makeAutoRunPanel(jmri.InstanceManager.getDefault(SignalSpeedMap.class).getInterpretation()); _controlPanel.add(_autoRunPanel); _controlPanel.add(Box.createVerticalStrut(STRUT_SIZE)); _forward.setSelected(true); _stageEStop.setSelected(false); _haltStartBox.setSelected(_haltStart); _calibrateBox.setSelected(false); _rampInterval.setText(Float.toString(_intervalTime / 1000)); JPanel p = new JPanel(); p.add(Box.createGlue()); JButton button = new JButton(Bundle.getMessage("ButtonRunNX")); button.addActionListener( (ActionEvent e) -> { makeAndRunWarrant(); }); p.add(button); p.add(Box.createHorizontalStrut(2 * STRUT_SIZE)); button = new JButton(Bundle.getMessage("ButtonCancel")); button.addActionListener( (ActionEvent e) -> { closeFrame(); }); p.add(button); p.add(Box.createGlue()); _controlPanel.add(p); _controlPanel.add(Box.createVerticalStrut(STRUT_SIZE)); _controlPanel.add(makeSwitchPanel()); mainPanel.add(_controlPanel); getContentPane().add(mainPanel); addWindowListener( new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent e) { closeFrame(); } }); setAlwaysOnTop(true); pack(); }
private void createMarginBox(Container c, Component comp) { c.add(Box.createVerticalStrut(10)); Box lrMargins = Box.createHorizontalBox(); lrMargins.add(Box.createHorizontalStrut(10)); lrMargins.add(comp); lrMargins.add(Box.createHorizontalStrut(10)); c.add(lrMargins); c.add(Box.createVerticalStrut(10)); }
/** Initialize the layout for the combo box. */ private void init(Object[] items) { this.setTitle("Shell Command"); this.setResizable(false); this.setMinimumSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT)); this.setMaximumSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT)); this.setPreferredSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT)); this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); JPanel mainWindow = new JPanel(); mainWindow.setLayout(new BoxLayout(mainWindow, BoxLayout.Y_AXIS)); mainWindow.setPreferredSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT)); JLabel message = new JLabel("Please enter or select your shell command."); mainWindow.add(Box.createVerticalStrut(10)); JPanel messagePanel = new JPanel(); messagePanel.setLayout(new BoxLayout(messagePanel, BoxLayout.X_AXIS)); messagePanel.add(message); mainWindow.add(messagePanel); mainWindow.add(Box.createVerticalStrut(5)); comboBox = new JComboBox(items); comboBox.setEditable(true); comboBox.addActionListener(this); comboBox.setPreferredSize(new Dimension(COMBO_BOX_WIDTH, COMBO_BOX_HEIGHT)); comboBox.setMinimumSize(new Dimension(COMBO_BOX_WIDTH, COMBO_BOX_HEIGHT)); comboBox.setMaximumSize(new Dimension(COMBO_BOX_WIDTH, COMBO_BOX_HEIGHT)); JPanel comboPane = new JPanel(); comboPane.setLayout(new BoxLayout(comboPane, BoxLayout.X_AXIS)); comboPane.add(comboBox); mainWindow.add(comboPane); mainWindow.add(Box.createVerticalStrut(5)); JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); okButton = new JButton("OK"); okButton.addActionListener(this); cancelButton = new JButton("Cancel"); cancelButton.addActionListener(this); buttonPane.add(cancelButton); buttonPane.add(okButton); mainWindow.add(buttonPane); mainWindow.add(Box.createVerticalStrut(5)); this.add(mainWindow); this.pack(); }
public RealCellEditor() { Box box = Box.createVerticalBox(); box.add(Box.createVerticalStrut(10)); // Add main title JLabel conflictLabel = new JLabel("Konflikt / debatt"); conflictLabel.setAlignmentX(0); conflictLabel.setFont(conflictLabel.getFont().deriveFont((float) 15)); JPanel labelPanel = new JPanel(); labelPanel.add(conflictLabel); box.add(labelPanel); box.add(Box.createVerticalStrut(15)); // Add help text JLabel helpLabel = new JLabel( "<html><center>Her kan du beskrive en konflikt<br> eller en debatt med ulike<br>synspunkter og argumenter.</center></html>"); helpLabel.setFont(conflictLabel.getFont().deriveFont((float) 11)); JPanel helpPanel = new JPanel(); helpPanel.add(helpLabel); box.add(helpPanel); box.add(Box.createVerticalStrut(15)); // Add topic with label JPanel tp = new JPanel(); tp.setLayout(new FlowLayout(FlowLayout.CENTER)); JPanel wrap = new JPanel(); wrap.add(topic); tp.add(wrap); wrap.setBorder(BorderFactory.createTitledBorder("Sentralt spørsmål eller tema:")); box.add(tp); box.add(Box.createVerticalStrut(10)); JPanel vps = new JPanel(new GridLayout(1, 2)); // Add viewpoints vp1.setBorder(BorderFactory.createTitledBorder("Synspunkt:")); vp1.setTextBackground(new Color(208, 255, 217)); vp2.setBorder(BorderFactory.createTitledBorder("Motstridende synspunkt:")); vp2.setTextBackground(new Color(255, 216, 207)); vps.add(vp1); vps.add(vp2); box.add(Box.createVerticalStrut(5)); box.add(vps); editorComponent.setLayout(new GridLayout(1, 1)); editorComponent.add(box); }
public ConstraintsPanel() { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); add(new DisplayUserDirectory()); add(Box.createVerticalStrut(15)); add(new DisplayParentDirectory("", "", false)); add(Box.createVerticalStrut(15)); add(new DisplayTemplate("", "")); add(Box.createVerticalStrut(15)); add(new DisplayResults()); add(Box.createVerticalStrut(15)); }
private JPanel createPreviewPanel() { JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); _screenshot = new PatternPaneScreenshot(_simg); createMarginBox(p, _screenshot); p.add(Box.createVerticalStrut(5)); p.add(_screenshot.createControls()); p.add(Box.createVerticalStrut(5)); p.add(msgApplied[tabSequence]); p.doLayout(); return p; }
public void prepareGUI() { mainFrame = new JFrame("Game of life"); mainFrame.setSize(750, 670); mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); grid = new GridPanel(board.getNumOfRows(), board.getNumOfColumns()); grid.setPreferredSize(new Dimension(600, 600)); grid.setBoard(this.board.getCurrentRound()); grid.addMouseListener(this); scrollPane = new JScrollPane(grid); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); buttonStart = new JButton("Start"); buttonStop = new JButton("Stop"); buttonNextRound = new JButton("Next round"); buttonClearBoard = new JButton("Clear board"); buttonStart.setMaximumSize( new Dimension(Integer.MAX_VALUE, buttonStart.getMinimumSize().height)); buttonStop.setMaximumSize(new Dimension(Integer.MAX_VALUE, buttonStop.getMinimumSize().height)); buttonNextRound.setMaximumSize( new Dimension(Integer.MAX_VALUE, buttonNextRound.getMinimumSize().height)); buttonClearBoard.setMaximumSize( new Dimension(Integer.MAX_VALUE, buttonClearBoard.getMinimumSize().height)); buttonStart.addActionListener(this); buttonStop.addActionListener(this); buttonNextRound.addActionListener(this); buttonClearBoard.addActionListener(this); generationsLabel = new JLabel("Generation " + numOfGenerations); drawingCheckBox = new JCheckBox("Drawing"); buttonsPanel = new JPanel(); buttonsPanel.setLayout(new BoxLayout(buttonsPanel, BoxLayout.PAGE_AXIS)); buttonsPanel.add(buttonStart); buttonsPanel.add(Box.createVerticalStrut(2)); buttonsPanel.add(buttonStop); buttonsPanel.add(Box.createVerticalStrut(2)); buttonsPanel.add(buttonNextRound); buttonsPanel.add(Box.createVerticalStrut(2)); buttonsPanel.add(buttonClearBoard); buttonsPanel.add(Box.createVerticalStrut(2)); buttonsPanel.add(generationsLabel); buttonsPanel.add(Box.createVerticalStrut(2)); buttonsPanel.add(drawingCheckBox); mainFrame.add(scrollPane, BorderLayout.CENTER); mainFrame.add(buttonsPanel, BorderLayout.EAST); }
public Component getDemoPanel() { // register two converters. Both for CustomType but the first one is the default, the second one // is for a special case. ObjectConverterManager.registerConverter(CustomType.class, new DefaultCustomTypeConverter()); ObjectConverterManager.registerConverter( CustomType.class, new SpecialCustomTypeConverter(), SpecialCustomTypeConverter.CONTEXT); JPanel panel = new JPanel(); panel.setLayout(new JideBoxLayout(panel, BoxLayout.Y_AXIS)); CustomType[] customTypes = new CustomType[] { new CustomType(1, "JIDE Docking Framework"), new CustomType(2, "JIDE Action Framework"), new CustomType(3, "JIDE Components"), new CustomType(4, "JIDE Grids"), new CustomType(5, "JIDE Dialogs"), }; panel.add( new JLabel( "<HTML>We defined a CustomType class which has two fields. See below." + "<PRE><BR> <FONT COLOR=\"BLUE\">public class</FONT> CustomType {" + "<BR> <FONT COLOR=\"BLUE\">int</FONT> <FONT COLOR=\"PURPLE\">_intValue</FONT>;" + "<BR> String <FONT COLOR=\"PURPLE\">_stringValue</FONT>;" + "<BR> }" + "<BR></PRE>" + "</HTML>")); panel.add(Box.createVerticalStrut(24), JideBoxLayout.FIX); panel.add(new JLabel("This ListComboBox uses default converter for this custom type")); panel.add(Box.createVerticalStrut(6), JideBoxLayout.FIX); AbstractComboBox comboBox1 = createListComboBox(customTypes); panel.add(comboBox1); panel.add(Box.createVerticalStrut(12), JideBoxLayout.FIX); panel.add(new JLabel("This one uses a special converter for this custom type")); panel.add(Box.createVerticalStrut(6), JideBoxLayout.FIX); AbstractComboBox comboBox2 = createListComboBox(customTypes); // comboBox2.setEditable(false); // set the context to use the special converter. comboBox2.setConverterContext(SpecialCustomTypeConverter.CONTEXT); panel.add(comboBox2); panel.add(Box.createVerticalStrut(12), JideBoxLayout.FIX); panel.add(Box.createGlue(), JideBoxLayout.VARY); return panel; }
private JPanel createTargetPanel() { JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); _tarOffsetPane = new PatternPaneTargetOffset(_simg, _imgBtn.getFilename(), _imgBtn.getTargetOffset()); createMarginBox(p, _tarOffsetPane); p.add(Box.createVerticalStrut(5)); p.add(_tarOffsetPane.createControls()); p.add(Box.createVerticalStrut(5)); p.add(msgApplied[tabSequence]); p.doLayout(); return p; }
public static void main(String[] args) { JFrame frame = new JFrame("Demo of Additional Borders"); frame.setIconImage(JideIconsFactory.getImageIcon(JideIconsFactory.JIDE32).getImage()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(new BorderLayout()); JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); panel.setLayout(new JideBoxLayout(panel, JideBoxLayout.Y_AXIS, 10)); JTextArea textField = new JTextArea(); JPanel border = new JPanel(new BorderLayout()); border.setPreferredSize(new Dimension(100, 100)); border.add(new JScrollPane(textField), BorderLayout.CENTER); border.setBorder( new JideTitledBorder( new PartialEtchedBorder(PartialEtchedBorder.LOWERED, PartialSide.NORTH), "PartialEtchedBorder")); JTextArea textField2 = new JTextArea(); JPanel border2 = new JPanel(new BorderLayout()); border2.setPreferredSize(new Dimension(100, 100)); border2.add(new JScrollPane(textField2), BorderLayout.CENTER); border2.setBorder( new JideTitledBorder( new PartialLineBorder(Color.darkGray, 1, PartialSide.NORTH), "PartialLineBorder")); JTextArea textField3 = new JTextArea(); JPanel border3 = new JPanel(new BorderLayout()); border3.setPreferredSize(new Dimension(100, 100)); border3.add(new JScrollPane(textField3), BorderLayout.CENTER); border3.setBorder( BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder( new PartialLineBorder(Color.gray, 1, true), "Rounded Corners Border"), BorderFactory.createEmptyBorder(0, 6, 4, 6))); panel.add(border, JideBoxLayout.FLEXIBLE); panel.add(Box.createVerticalStrut(12)); panel.add(border2, JideBoxLayout.FLEXIBLE); panel.add(Box.createVerticalStrut(12)); panel.add(border3, JideBoxLayout.FLEXIBLE); panel.add(Box.createGlue(), JideBoxLayout.VARY); panel.setPreferredSize(new Dimension(500, 400)); frame.getContentPane().add(panel, BorderLayout.CENTER); frame.pack(); frame.setVisible(true); }
private void initComponents() { FlippingSplitPane upperPane = new FlippingSplitPane("SpellBooksTop"); Box box = Box.createVerticalBox(); JScrollPane pane = new JScrollPane(availableTable); pane.setPreferredSize(new Dimension(250, 300)); box.add(pane); box.add(Box.createVerticalStrut(5)); { Box hbox = Box.createHorizontalBox(); hbox.add(Box.createHorizontalStrut(5)); hbox.add(new JLabel(LanguageBundle.getString("InfoSpells.set.auto.book"))); hbox.add(Box.createHorizontalGlue()); box.add(hbox); } box.add(Box.createVerticalStrut(5)); { Box hbox = Box.createHorizontalBox(); hbox.add(Box.createHorizontalStrut(5)); hbox.add(defaultBookCombo); hbox.add(Box.createHorizontalGlue()); hbox.add(Box.createHorizontalStrut(5)); hbox.add(addButton); hbox.add(Box.createHorizontalStrut(5)); box.add(hbox); } box.add(Box.createVerticalStrut(5)); upperPane.setLeftComponent(box); box = Box.createVerticalBox(); box.add(new JScrollPane(selectedTable)); box.add(Box.createVerticalStrut(5)); { Box hbox = Box.createHorizontalBox(); hbox.add(Box.createHorizontalStrut(5)); hbox.add(removeButton); hbox.add(Box.createHorizontalGlue()); box.add(hbox); } box.add(Box.createVerticalStrut(5)); upperPane.setRightComponent(box); upperPane.setResizeWeight(0); setTopComponent(upperPane); FlippingSplitPane bottomPane = new FlippingSplitPane("SpellBooksBottom"); bottomPane.setLeftComponent(spellsPane); bottomPane.setRightComponent(classPane); setBottomComponent(bottomPane); setOrientation(VERTICAL_SPLIT); }
protected JPanel createOptionalPropPane() { JPanel optionalPane = new JPanel(); optionalPane.setLayout(new BoxLayout(optionalPane, BoxLayout.Y_AXIS)); JPanel reactomeIdPane = createReactomeIDPane(); reactomeIdPane.setBorder(BorderFactory.createEtchedBorder()); optionalPane.add(reactomeIdPane); optionalPane.add(Box.createVerticalStrut(4)); // For setting alternative names alternativeNamePane = createAlternativeNamesPane(); optionalPane.add(alternativeNamePane); optionalPane.add(Box.createVerticalStrut(4)); summationPane = new TextSummationPane(); optionalPane.add(summationPane); return optionalPane; }
/** Adds the button row and the Spam Button */ private void addButtonRow() { if (BUTTON_ROW != null) { SOUTH_PANEL = Box.createVerticalBox(); SOUTH_PANEL.setOpaque(false); SOUTH_PANEL.add(Box.createVerticalStrut(GUIConstants.SEPARATOR)); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.NONE; gbc.gridwidth = GridBagConstraints.RELATIVE; gbc.weightx = 1; buttonPanel.add(BUTTON_ROW, gbc); buttonPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, 64)); SOUTH_PANEL.add(buttonPanel); MAIN_PANEL.add(SOUTH_PANEL); } }
/** @return A Box for selecting an asset type, the old asset and its replacement asset. */ private Box assetChoiceBox() { TreeSet<String> types = new TreeSet<String>(); types.add(AssetType.CHARACTER.toString()); types.add(AssetType.PROP.toString()); types.add(AssetType.SET.toString()); // JDrawer toReturn; Box hbox = new Box(BoxLayout.X_AXIS); { JCollectionField assetType = UIFactory.createCollectionField(types, diag, sTSize); assetType.setActionCommand("type"); assetType.addActionListener(this); JCollectionField oldAsset = UIFactory.createCollectionField(charList.keySet(), diag, sVSize); JCollectionField newAsset = UIFactory.createCollectionField(charList.keySet(), diag, sVSize); hbox.add(assetType); hbox.add(Box.createHorizontalStrut(10)); hbox.add(oldAsset); hbox.add(Box.createHorizontalStrut(5)); hbox.add(newAsset); // pPotentials.put(oldAsset, newAsset); } list.add(Box.createVerticalStrut(5)); return hbox; // toReturn; } // return assetChoiceBox
/** * The constructor constructs all of the elements of this <tt>AbstractPaneItem</tt>. * * @param key the key for this <tt>AbstractPaneItem</tt> that the superclass uses to generate * strings */ public SharedDirPaneItem() { super(TITLE, LABEL); sharingPanel.setFileFilter( new FileFilter() { // private final FileManager fileManager = GuiCoreMediator.getFileManager(); public boolean accept(File pathname) { return true; // return fileManager.isFolderShareable(pathname, false); } }); sharingPanel.getTree().setRootVisible(false); sharingPanel.getTree().setShowsRootHandles(true); JPanel buttonPanel = new JPanel(new BorderLayout()); buttonPanel.setBorder(new EmptyBorder(0, 4, 0, 0)); JPanel buttons = new JPanel(new BorderLayout()); buttons.add( new JButton(new SelectSharedDirectoryAction(sharingPanel, sharingPanel)), BorderLayout.NORTH); buttons.add(Box.createVerticalStrut(4), BorderLayout.CENTER); buttons.add(new JButton(new RemoveSharedDirectoryAction(sharingPanel)), BorderLayout.SOUTH); buttonPanel.add(buttons, BorderLayout.NORTH); sharingPanel.addEastPanel(buttonPanel); add(sharingPanel); }
/** * Constructor for FontDialog * * @param parent the parent frame needed by all dialogs * @param text the text we want to set. */ public FontDialog(JFrame parent) { super(parent, "Font", true); effect_ = DrawSWFFont.NO_EFFECT; effect_buttons_ = new JRadioButton[3]; draw_font_ = null; self_ = this; getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS)); getContentPane().add(createFontSelection()); getContentPane().add(createFontEffects()); getContentPane().add(createColorChoice()); getContentPane().add(Box.createVerticalStrut(5)); getContentPane().add(createTextField()); getContentPane().add(createButtons()); updatePreview(); pack(); Dimension d1 = getSize(); Dimension d2 = parent.getSize(); int x = Math.max((d2.width - d1.width) / 2, 0); int y = Math.max((d2.height - d1.height) / 2, 0); setBounds(x, y, d1.width, d1.height); }
/** * Creates a new wait dialog with the specified information * * @param owner Parent frame of the new dialog * @param title Title of the dialog * @param message Message to be displayed within the dialog. */ public WaitDialog(Frame owner, String title, String message) { super(owner, title, false); this.title = title; this.message = message; this.setSize(300, 150); JPanel contentPanel = new JPanel(); contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS)); contentPanel.add(Box.createVerticalGlue()); JLabel messageLabel = new JLabel(message); messageLabel.setAlignmentX(JLabel.CENTER_ALIGNMENT); contentPanel.add(messageLabel); contentPanel.add(Box.createVerticalStrut(10)); JProgressBar waitBar = new JProgressBar(); waitBar.setIndeterminate(true); waitBar.setAlignmentX(JProgressBar.CENTER_ALIGNMENT); JPanel waitBarPanel = new JPanel(); waitBarPanel.setOpaque(false); waitBarPanel.setLayout(new BoxLayout(waitBarPanel, BoxLayout.X_AXIS)); waitBarPanel.add(Box.createHorizontalGlue()); waitBarPanel.add(waitBar); waitBarPanel.add(Box.createHorizontalGlue()); contentPanel.add(waitBarPanel); contentPanel.add(Box.createVerticalGlue()); this.add(contentPanel); this.setLocationRelativeTo(owner); }
@Inject protected StringPatternListPanel( DCGlassPane glassPane, AnalyzerBeansConfiguration configuration, WindowContext windowContext, UserPreferences userPreferences) { super(WidgetUtils.BG_COLOR_BRIGHT, WidgetUtils.BG_COLOR_BRIGHTEST); _glassPane = glassPane; _configuration = configuration; _windowContext = windowContext; _userPreferences = userPreferences; _catalog = (MutableReferenceDataCatalog) _configuration.getReferenceDataCatalog(); _catalog.addStringPatternListener(this); _listPanel = new DCPanel(); _listPanel.setLayout(new VerticalLayout(4)); updateComponents(); final DCLabel newStringPatternsLabel = DCLabel.dark("Create new string pattern:"); newStringPatternsLabel.setFont(WidgetUtils.FONT_HEADER1); final DCLabel existingStringPatternsLabel = DCLabel.dark("Existing string patterns:"); existingStringPatternsLabel.setFont(WidgetUtils.FONT_HEADER1); setLayout(new VerticalLayout(10)); add(newStringPatternsLabel); add(createNewStringPatternsPanel()); add(Box.createVerticalStrut(10)); add(existingStringPatternsLabel); setBorder(new EmptyBorder(10, 10, 10, 0)); add(_listPanel); }
public UpdateOrStatusOptionsDialog(Project project, Map<Configurable, AbstractVcs> confs) { super(project); setTitle(getRealTitle()); myProject = project; if (confs.size() == 1) { myMainPanel = new JPanel(new BorderLayout()); final Configurable configurable = confs.keySet().iterator().next(); addComponent(confs.get(configurable), configurable, BorderLayout.CENTER); myMainPanel.add(Box.createVerticalStrut(10), BorderLayout.SOUTH); } else { myMainPanel = new JBTabbedPane(); final ArrayList<AbstractVcs> vcses = new ArrayList<>(confs.values()); Collections.sort( vcses, new Comparator<AbstractVcs>() { public int compare(final AbstractVcs o1, final AbstractVcs o2) { return o1.getDisplayName().compareTo(o2.getDisplayName()); } }); Map<AbstractVcs, Configurable> vcsToConfigurable = revertMap(confs); for (AbstractVcs vcs : vcses) { addComponent(vcs, vcsToConfigurable.get(vcs), vcs.getDisplayName()); } } init(); }
/** * Add a strut, or rigid spacing, to a UI component * * @param b the component to add the strut to, should be either a Box or a Container using a * BoxLayout. * @param layout the desired layout orientation of the strut. One of {@link * javax.swing.BoxLayout#X_AXIS}, {@link javax.swing.BoxLayout#Y_AXIS}, {@link * javax.swing.BoxLayout#LINE_AXIS}, or {@link javax.swing.BoxLayout#PAGE_AXIS}. * @param size the length, in pixels, of the strut */ public static void addStrut(JComponent b, int layout, int size) { if (size < 1) return; b.add( getAxis(b, layout) == BoxLayout.X_AXIS ? Box.createHorizontalStrut(size) : Box.createVerticalStrut(size)); }
public void init(List<T> sources) { this.sources = sources; consoles = new HashMap<T, ConsolePanel>(); singleNodeGUIS = new ArrayList<JComponent>(); // setPreferredSize(new Dimension(1000,700)); JSplitPane[] leftAndRight = new JSplitPane[] { new JSplitPane(JSplitPane.VERTICAL_SPLIT), new JSplitPane(JSplitPane.VERTICAL_SPLIT) }; for (int i = 0; i < sources.size(); i++) { T t = sources.get(i); Box box = Box.createVerticalBox(); ConsolePanel console = createConsole(); consoles.put(t, console); JScrollPane jsp = new JScrollPane(console); jsp.setMinimumSize(new Dimension(600, 300)); jsp.setPreferredSize(new Dimension(600, 300)); jsp.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE)); box.add(jsp); // box.add(Box.createVerticalGlue()); box.add(createInputTF(t)); box.add(Box.createVerticalStrut(3)); box.setBorder(BorderFactory.createTitledBorder(String.valueOf(t))); singleNodeGUIS.add(box); leftAndRight[i / 2].add(box); } add(leftAndRight[0]); add(leftAndRight[1]); }
/** * Shows a dialog request to enter text in a multiline text field <br> * Though not all text might be visible, everything entered is delivered with the returned text * <br> * The main purpose for this feature is to allow pasting text from somewhere preserving line * breaks <br> * * @param msg the message to display. * @param title the title for the dialog (default: Sikuli input request) * @param lines the maximum number of lines visible in the text field (default 9) * @param width the maximum number of characters visible in one line (default 20) * @return The user's input including the line breaks. */ public static String inputText(String msg, String title, int lines, int width) { width = Math.max(20, width); lines = Math.max(9, lines); if ("".equals(title)) { title = "Sikuli input request"; } JTextArea ta = new JTextArea(""); int w = width * ta.getFontMetrics(ta.getFont()).charWidth('m'); int h = (int) (lines * ta.getFontMetrics(ta.getFont()).getHeight()); ta.setPreferredSize(new Dimension(w, h)); ta.setMaximumSize(new Dimension(w, 2 * h)); JScrollPane sp = new JScrollPane(ta); sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); JTextArea tm = new JTextArea(msg); tm.setColumns(width); tm.setLineWrap(true); tm.setWrapStyleWord(true); tm.setEditable(false); tm.setBackground(new JLabel().getBackground()); JPanel pnl = new JPanel(); pnl.setLayout(new BoxLayout(pnl, BoxLayout.Y_AXIS)); pnl.add(sp); pnl.add(Box.createVerticalStrut(10)); pnl.add(tm); pnl.add(Box.createVerticalStrut(10)); if (0 == JOptionPane.showConfirmDialog(null, pnl, title, JOptionPane.OK_CANCEL_OPTION)) { return ta.getText(); } else { return ""; } }