private JTabbedPane createTab() { Font mainFont = new Font("Times New Roman", Font.BOLD, 11); tabbedPane.setFont(mainFont); tabbedPane.setBorder(new BevelBorder(BevelBorder.LOWERED)); tabbedPane.add("New application", new NewAppPanel()); JPanel existingApp = new JPanel(); existingApp.setLayout(new BoxLayout(existingApp, BoxLayout.X_AXIS)); JLabel pictureLabel = new JLabel("Configuration:"); JButton pictureChooser = new JButton("Choose"); pictureFileName.setEditable(false); pictureFileName.setMaximumSize(new Dimension(contentPane.getPreferredSize().width, 25)); existingApp.add(Box.createHorizontalStrut(20)); existingApp.add(pictureLabel); existingApp.add(pictureFileName); existingApp.add(Box.createHorizontalStrut(5)); existingApp.add(pictureChooser); existingApp.add(Box.createHorizontalStrut(20)); pictureChooser.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { loadFromFile(); } }); tabbedPane.add("Existing application", existingApp); tabbedPane.setPreferredSize(contentPane.getPreferredSize()); return tabbedPane; }
public ActionBar(View view, boolean temp) { setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); this.view = view; this.temp = temp; add(Box.createHorizontalStrut(2)); JLabel label = new JLabel(jEdit.getProperty("view.action.prompt")); add(label); add(Box.createHorizontalStrut(12)); add(action = new ActionTextField()); action.setEnterAddsToHistory(false); Dimension max = action.getPreferredSize(); max.width = Integer.MAX_VALUE; action.setMaximumSize(max); action.addActionListener(new ActionHandler()); action.getDocument().addDocumentListener(new DocumentHandler()); if (temp) { close = new RolloverButton(GUIUtilities.loadIcon("closebox.gif")); close.addActionListener(new ActionHandler()); close.setToolTipText(jEdit.getProperty("view.action.close-tooltip")); add(close); } this.temp = temp; }
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))); }
/** @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
public PaymentPanel(final CreditCardService cardService) { setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); add(new JLabel("Credit Card")); add(Box.createHorizontalStrut(5)); final JTextField creditCard = new JTextField(30); add(creditCard); add(Box.createHorizontalStrut(5)); JButton purchase = new JButton("Purchase"); purchase.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { double total = cartTableModel.getTotal(); String cardNumber = creditCard.getText(); String confirmation = "Do you want to charge " + total + " to your " + cardNumber + " card?"; String title = "Confirm charge"; int confirm = JOptionPane.showConfirmDialog( PaymentPanel.this, confirmation, title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (confirm == JOptionPane.YES_OPTION) { CreditCard card = new CreditCard(cardNumber); cardService.debit(card, total); } } }); add(Box.createHorizontalStrut(5)); add(purchase); }
/** * Constructs the Gui used to edit properties; called from each constructor. Constructs labels and * text fields for editing each property and adds appropriate listeners. */ private void buildGui() { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); if (alphaField != null) { Box b1 = Box.createHorizontalBox(); b1.add(new JLabel("Alpha:")); b1.add(Box.createHorizontalStrut(10)); b1.add(Box.createHorizontalGlue()); b1.add(alphaField); add(b1); } Box b2 = Box.createHorizontalBox(); b2.add(new JLabel("Depth:")); b2.add(Box.createHorizontalStrut(10)); b2.add(Box.createHorizontalGlue()); b2.add(depthField); add(b2); // Box b4 = Box.createHorizontalBox(); // b4.add(Box.createHorizontalStrut(25)); // b4.add(new JLabel("(where possible)")); // b4.add(Box.createHorizontalGlue()); // add(b4); add(Box.createHorizontalGlue()); }
/** * 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 HeaderPanel(String heading) { super(); this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); this.setBackground(background); JLabel panelLabel = new JLabel(" " + heading, SwingConstants.LEFT); Font labelFont = new Font("Dialog", Font.BOLD, 18); panelLabel.setFont(labelFont); this.add(panelLabel); this.add(Box.createHorizontalGlue()); refresh = new JButton("Refresh"); refresh.addActionListener(this); this.add(refresh); this.add(Box.createHorizontalStrut(5)); root = new JComboBox(); Dimension d = root.getPreferredSize(); d.width = 90; root.setPreferredSize(d); root.setMaximumSize(d); File[] roots = directoryPane.getRoots(); for (int i = 0; i < roots.length; i++) root.addItem(roots[i].getAbsolutePath()); this.add(root); root.setSelectedIndex(directoryPane.getCurrentRootIndex()); root.addActionListener(this); this.add(Box.createHorizontalStrut(17)); }
/** Constructs this CytoPanel. */ private void constructPanel() { // init our components initLabel(); initButtons(); // add label and button components to yet another panel, // so we can layout properly final JPanel floatDockPanel = new JPanel(); final BoxLayout boxLayout = new BoxLayout(floatDockPanel, BoxLayout.X_AXIS); floatDockPanel.setLayout(boxLayout); floatDockPanel.add(Box.createHorizontalStrut(8)); floatDockPanel.add(floatLabel); floatDockPanel.add(Box.createHorizontalGlue()); floatDockPanel.add(floatButton); floatDockPanel.add(closeButton); floatDockPanel.add(Box.createHorizontalStrut(8)); // set preferred size - we can use float or dock icon dimensions - they are the same final FontMetrics fm = floatLabel.getFontMetrics(floatLabel.getFont()); floatDockPanel.setMinimumSize( new Dimension( (fm.stringWidth(getTitle()) + BUTTON_SIZE) * FLOAT_PANEL_SCALE_FACTOR, BUTTON_SIZE)); floatDockPanel.setPreferredSize( new Dimension( (fm.stringWidth(getTitle()) + BUTTON_SIZE) * FLOAT_PANEL_SCALE_FACTOR, BUTTON_SIZE + 10)); // use the border layout for this CytoPanel setLayout(new BorderLayout()); add(floatDockPanel, BorderLayout.NORTH); add(tabbedPane, BorderLayout.CENTER); }
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)); }
/** @return JPanel Panel with checkbox to choose user and password */ private Component createAuthPane() { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS)); panel.add(useAuth); panel.add(Box.createHorizontalStrut(10)); panel.add(mqttUser); panel.add(Box.createHorizontalStrut(10)); panel.add(mqttPwd); return panel; }
public static JPanel createHorizontalMarginPanel( JComponent content, int leftMargin, int rightMargin) { JPanel panel = new JPanel(); panel.setAlignmentX(JPanel.LEFT_ALIGNMENT); panel.setAlignmentY(JPanel.TOP_ALIGNMENT); panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS)); panel.add(Box.createHorizontalStrut(leftMargin)); panel.add(content); panel.add(Box.createHorizontalStrut(rightMargin)); return panel; }
// Center given button in a box, centered vertically and 6 pixels on left and right private Box createBoxForButton(JButton button) { Box buttonRow = Box.createHorizontalBox(); buttonRow.add(Box.createHorizontalStrut(6)); buttonRow.add(button); buttonRow.add(Box.createHorizontalStrut(6)); Box buttonBox = Box.createVerticalBox(); buttonBox.add(Box.createVerticalGlue()); buttonBox.add(buttonRow); buttonBox.add(Box.createVerticalGlue()); return buttonBox; }
void initComponents() { JPanel mainPanel = new JPanel(new BorderLayout()); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); Color bgColor = Color.getHSBColor(0.58f, 0.17f, 0.95f); buttonPanel.setBackground(bgColor); Border empty = BorderFactory.createEmptyBorder(5, 5, 5, 5); buttonPanel.setBorder(empty); textField = new JTextField(75); buttonPanel.add(textField); buttonPanel.add(Box.createHorizontalStrut(10)); searchPHI = new JButton("Search PHI"); searchPHI.addActionListener(this); buttonPanel.add(searchPHI); buttonPanel.add(Box.createHorizontalStrut(10)); searchTrial = new JButton("Search Trial IDs"); searchTrial.addActionListener(this); buttonPanel.add(searchTrial); buttonPanel.add(Box.createHorizontalStrut(20)); buttonPanel.add(Box.createHorizontalGlue()); saveAs = new JCheckBox("Save As..."); saveAs.setBackground(bgColor); buttonPanel.add(saveAs); mainPanel.add(buttonPanel, BorderLayout.NORTH); JScrollPane scrollPane = new JScrollPane(); textPane = new ColorPane(); // textPane.setEditable(false); scrollPane.setViewportView(textPane); mainPanel.add(scrollPane, BorderLayout.CENTER); JPanel footerPanel = new JPanel(); footerPanel.setLayout(new BoxLayout(footerPanel, BoxLayout.X_AXIS)); footerPanel.setBackground(bgColor); message = new JLabel("Ready..."); footerPanel.add(message); mainPanel.add(footerPanel, BorderLayout.SOUTH); setTitle(windowTitle); addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent evt) { System.exit(0); } }); getContentPane().add(mainPanel, BorderLayout.CENTER); pack(); centerFrame(); }
public JPanel demo(Graph g, final String label) { // create a new radial tree view final PhysioMapRadialGraphView gview = new PhysioMapRadialGraphView(settings, g, label, semsimmodel); Visualization vis = gview.getVisualization(); // create a search panel for the tree map SearchQueryBinding sq = new SearchQueryBinding( (Table) vis.getGroup(treeNodes), label, (SearchTupleSet) vis.getGroup(Visualization.SEARCH_ITEMS)); JSearchPanel search = sq.createSearchPanel(); search.setShowResultCount(true); search.setBorder(BorderFactory.createEmptyBorder(5, 5, 4, 0)); search.setFont(FontLib.getFont("Verdana", Font.PLAIN, 11)); final JTextArea title = new JTextArea(); title.setPreferredSize(new Dimension(450, 500)); title.setMaximumSize(new Dimension(450, 500)); title.setMinimumSize(new Dimension(450, 500)); title.setAlignmentY(CENTER_ALIGNMENT); title.setLineWrap(true); title.setWrapStyleWord(true); title.setBorder(BorderFactory.createEmptyBorder(3, 0, 0, 0)); title.setFont(FontLib.getFont("Verdana", Font.PLAIN, 11)); gview.addControlListener( new ControlAdapter() { public void itemEntered(VisualItem item, MouseEvent e) {} public void itemExited(VisualItem item, MouseEvent e) { title.setText(null); } }); Box searchbox = new Box(BoxLayout.X_AXIS); searchbox.add(Box.createHorizontalStrut(10)); searchbox.add(search); searchbox.add(Box.createHorizontalStrut(3)); JPanel panel = new JPanel(new BorderLayout()); panel.add(searchbox, BorderLayout.NORTH); panel.add(gview, BorderLayout.CENTER); panel.add(Box.createGlue(), BorderLayout.SOUTH); Color BACKGROUND = Color.WHITE; Color FOREGROUND = Color.DARK_GRAY; UILib.setColor(panel, BACKGROUND, FOREGROUND); return panel; }
/** * Constructor of class Wizard * * @param parent the parent frame * @param name the title of the dialog * @param modal whether the dialog should be modal */ public Wizard(JFrame parent, String name, boolean modal) { super(parent, name, modal); // Code inspired by http://java.sun.com/developer/technicalArticles/GUI/swing/wizard/ listeners = new LinkedList<WizardListener>(); returnCode = -1; this.parent = parent; panelMap = new HashMap<Object, WizardPanel>(); panels = new Vector<WizardPanel>(); firstPanel = null; currentPanel = null; handler = new EventHandler(); // Create the main panel JPanel buttonPanel = new JPanel(); Box buttonBox = new Box(BoxLayout.X_AXIS); cardPanel = new JPanel(); cardPanel.setBorder(new EmptyBorder(new Insets(5, 10, 5, 10))); cardLayout = new CardLayout(); cardPanel.setLayout(cardLayout); backButton = new JButton("Back"); nextButton = new JButton("Next"); cancelButton = new JButton("Cancel"); backButton.addActionListener(handler); nextButton.addActionListener(handler); cancelButton.addActionListener(handler); backButton.setEnabled(false); buttonPanel.setLayout(new BorderLayout()); buttonPanel.add(new JSeparator(), BorderLayout.NORTH); buttonBox.setBorder(new EmptyBorder(new Insets(5, 10, 5, 10))); buttonBox.add(backButton); buttonBox.add(Box.createHorizontalStrut(10)); buttonBox.add(nextButton); buttonBox.add(Box.createHorizontalStrut(30)); buttonBox.add(cancelButton); buttonPanel.add(buttonBox, java.awt.BorderLayout.EAST); getContentPane().add(buttonPanel, java.awt.BorderLayout.SOUTH); getContentPane().add(cardPanel, java.awt.BorderLayout.CENTER); pack(); }
// {{{ init() method private void init() { EditBus.addToBus(this); /* Setup panes */ JPanel content = new JPanel(new BorderLayout(12, 12)); content.setBorder(new EmptyBorder(12, 12, 12, 12)); setContentPane(content); tabPane = new JTabbedPane(); tabPane.addTab(jEdit.getProperty("manage-plugins.title"), manager = new ManagePanel(this)); tabPane.addTab( jEdit.getProperty("update-plugins.title"), updater = new InstallPanel(this, true)); tabPane.addTab( jEdit.getProperty("install-plugins.title"), installer = new InstallPanel(this, false)); EditBus.addToBus(installer); content.add(BorderLayout.CENTER, tabPane); tabPane.addChangeListener(new ListUpdater()); /* Create the buttons */ Box buttons = new Box(BoxLayout.X_AXIS); ActionListener al = new ActionHandler(); mgrOptions = new JButton(jEdit.getProperty("plugin-manager.mgr-options")); mgrOptions.addActionListener(al); pluginOptions = new JButton(jEdit.getProperty("plugin-manager.plugin-options")); pluginOptions.addActionListener(al); done = new JButton(jEdit.getProperty("plugin-manager.done")); done.addActionListener(al); buttons.add(Box.createGlue()); buttons.add(mgrOptions); buttons.add(Box.createHorizontalStrut(6)); buttons.add(pluginOptions); buttons.add(Box.createHorizontalStrut(6)); buttons.add(done); buttons.add(Box.createGlue()); getRootPane().setDefaultButton(done); content.add(BorderLayout.SOUTH, buttons); setDefaultCloseOperation(DISPOSE_ON_CLOSE); setIconImage(GUIUtilities.getPluginIcon()); pack(); GUIUtilities.loadGeometry(this, parent, "plugin-manager"); GUIUtilities.addSizeSaver(this, parent, "plugin-manager"); setVisible(true); } // }}}
/** kreiert das Menü oben */ private JToolBar createMenu() { JToolBar toolbar = new JToolBar(); toolbar.setOrientation(SwingConstants.HORIZONTAL); toolbar.setFloatable(false); toolbar.setMargin(new Insets(2, 35, 2, 0)); toolbar.setBackground(new Color(219, 255, 179)); zoomIn = FsmUtils.createButton(zoomInImg); zoomIn.setToolTipText("Vergr��ern"); zoomIn.addMouseListener(new ZoomInHandler(this)); zoomOut = FsmUtils.createButton(zoomOutImg); zoomOut.setToolTipText("Verkleinern"); zoomOut.addMouseListener(new ZoomOutHandler(this)); layout = FsmUtils.createButton(layoutImg); layout.setToolTipText("Automatisch layouten"); layout.addMouseListener(new LayoutHandler(this)); deterministic = new JRadioButton("deterministisch"); deterministic.setToolTipText("Der endliche Automat wird deterministisch"); deterministic.setBackground(new Color(219, 255, 179)); deterministic.addMouseListener(new TypeOfFsmHandler(this, false)); nondeterministic = new JRadioButton("nichtdeterministisch"); nondeterministic.setToolTipText("Der endliche Automat wird nichtdeterministisch"); nondeterministic.setBackground(new Color(219, 255, 179)); nondeterministic.addMouseListener(new TypeOfFsmHandler(this, true)); ButtonGroup group = new ButtonGroup(); group.add(deterministic); group.add(nondeterministic); if (this.getFsmProgram().isNondeterministic()) { group.setSelected(nondeterministic.getModel(), true); } else { group.setSelected(deterministic.getModel(), true); } toolbar.add(zoomIn); toolbar.add(Box.createHorizontalStrut(2)); toolbar.add(zoomOut); toolbar.add(Box.createHorizontalStrut(2)); toolbar.add(Box.createHorizontalStrut(2)); toolbar.add(layout); toolbar.addSeparator(); toolbar.add(deterministic); toolbar.add(nondeterministic); return toolbar; }
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); }
public NavigatePanel(DatePicker parent) { this.parent = parent; setLayout(new BorderLayout()); Dimension d = new Dimension(20, 20); Box box = new Box(BoxLayout.X_AXIS); preyear = new JButton(); preyear.setToolTipText(parent.getString("pre.year", "Previous year.")); ImageIcon icon = new ImageIcon(getImage("preyear.gif"), "<<"); preyear.setIcon(icon); preyear.addActionListener(this); preyear.setPreferredSize(d); box.add(preyear); box.add(Box.createHorizontalStrut(3)); premon = new JButton(); premon.setToolTipText(parent.getString("pre.mon", "Previous Month")); icon = new ImageIcon(getImage("premon.gif"), "<"); premon.setIcon(icon); premon.addActionListener(this); premon.setPreferredSize(d); box.add(premon); add(box, BorderLayout.WEST); box = new Box(BoxLayout.X_AXIS); nextmon = new JButton(); nextmon.setToolTipText(parent.getString("next.mon", "Next month.")); icon = new ImageIcon(getImage("nextmon.gif"), ">"); nextmon.setIcon(icon); nextmon.setPreferredSize(d); nextmon.addActionListener(this); box.add(nextmon); box.add(Box.createHorizontalStrut(3)); nextyear = new JButton(); nextyear.setToolTipText(parent.getString("next.year", "Next year.")); icon = new ImageIcon(getImage("nextyear.gif"), ">>"); nextyear.setIcon(icon); nextyear.setPreferredSize(d); nextyear.addActionListener(this); box.add(nextyear); add(box, BorderLayout.EAST); setCurrentMonth(parent.calendar); // setLabel(parent.calendar); }
protected JComponent createTitleArea(String demoSetTitle) { JPanel titleAreaPanel = new JPanel(new BorderLayout()); titlePanel = new GradientPanel( UIManager.getColor(CourierSystem.TITLE_GRADIENT_COLOR1_KEY), UIManager.getColor(CourierSystem.TITLE_GRADIENT_COLOR2_KEY)); titlePanel.setLayout(new BorderLayout()); titlePanel.setBorder(panelBorder); demoListLabel = new JLabel(demoSetTitle); demoListLabel.setOpaque(false); demoListLabel.setHorizontalAlignment(JLabel.LEADING); titlePanel.add(demoListLabel, BorderLayout.CENTER); titleAreaPanel.add(titlePanel, BorderLayout.NORTH); // Add panel with view combobox viewPanel = new JPanel(); viewPanel.setLayout(new BoxLayout(viewPanel, BoxLayout.X_AXIS)); viewPanel.setBorder(new CompoundBorder(chiselBorder, new EmptyBorder(12, 8, 12, 8))); JLabel viewLabel = new JLabel("Hi:"); viewPanel.add(viewLabel); viewPanel.add(Box.createHorizontalStrut(6)); JLabel viewComboBox = new JLabel(); viewComboBox.setText(args[1].toUpperCase().toString()); // viewComboBox.addItem("By Category"); viewPanel.add(viewComboBox); titleAreaPanel.add(viewPanel, BorderLayout.CENTER); return titleAreaPanel; }
public LibraryManagerUI(Frame parent, Platform platform) { super(parent, "Library Manager", Dialog.ModalityType.APPLICATION_MODAL, _("Unable to reach Arduino.cc due to possible network issues.")); this.platform = platform; filtersContainer.add(new JLabel(_("Topic")), 1); filtersContainer.remove(2); typeChooser = new JComboBox(); typeChooser.setMaximumRowCount(20); typeChooser.setEnabled(false); filtersContainer.add(Box.createHorizontalStrut(5), 0); filtersContainer.add(new JLabel(_("Type")), 1); filtersContainer.add(Box.createHorizontalStrut(5), 2); filtersContainer.add(typeChooser, 3); }
public OutputTab( GradlePluginLord gradlePluginLord, OutputPanelParent parent, String header, AlternateUIInteraction alternateUIInteraction) { super(gradlePluginLord, parent, alternateUIInteraction); mainPanel = new JPanel(); mainPanel.setOpaque(false); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.X_AXIS)); mainTextLabel = new JLabel(header); if (pinnedIcon == null) { pinnedIcon = getImageIconResource("/org/gradle/gradleplugin/userinterface/swing/generic/pin.png"); } pinnedLabel = new JLabel(pinnedIcon); pinnedLabel.setVisible(isPinned()); setupCloseLabel(); mainPanel.add(mainTextLabel); mainPanel.add(Box.createHorizontalStrut(5)); mainPanel.add(pinnedLabel); mainPanel.add(closeLabel); }
/** Builds and lays out the UI. */ private void buildGUI() { setBackground(UIUtilities.BACKGROUND_COLOR); JToolBar bar = new JToolBar(); bar.setBackground(UIUtilities.BACKGROUND_COLOR); bar.setBorder(null); bar.setRollover(true); bar.setFloatable(false); JButton b = new JButton(control.getAction(RendererControl.SAVE)); UIUtilities.unifiedButtonLookAndFeel(b); b.setText(ManageRndSettingsAction.NAME_SAVE); b.setBackground(UIUtilities.BACKGROUND_COLOR); bar.add(b); /* b = new JButton(control.getAction(RendererControl.VIEW)); UIUtilities.unifiedButtonLookAndFeel(b); b.setBackground(UIUtilities.BACKGROUND_COLOR); bar.add(b); */ setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); add(bar); add(Box.createHorizontalStrut(5)); JPanel p = UIUtilities.buildComponentPanelRight(selectedPlane); p.setBackground(UIUtilities.BACKGROUND_COLOR); add(p); }
public void addLayer(Layer layer, boolean showOnButtonList, String icon) { if (layer instanceof MapViewerLayer) { minZoom = Math.max(((MapViewerLayer) layer).getMinZoomLevel(), getMinZoom()); maxZoom = Math.min(((MapViewerLayer) layer).getMaxZoomLevel(), getMaxZoom()); if (zoomFactor > maxZoom || zoomFactor < minZoom) { zoomFactor = (maxZoom + minZoom) / 2; } zoomTo(center, zoom2Scale(zoomFactor)); } if (showOnButtonList) { JToggleButton b = new JToggleButton(layer.name, LogicConstants.getIcon(icon), layer.visible); // b.setVerticalTextPosition(SwingConstants.BOTTOM); // b.setHorizontalTextPosition(SwingConstants.CENTER); b.setActionCommand(layer.name); b.addActionListener(layerControlListener); layerControls.add(b); layerControlPanel.removeAll(); layerControlPanel.add(Box.createHorizontalStrut(10)); for (JToggleButton bt : layerControls) { layerControlPanel.add(bt); layerControlPanel.add(Box.createHorizontalGlue()); } layerControlPanel.updateUI(); } super.addLayer(layer); }
private JComponent createAddPrefixComponent(final SourceFolder folder) { final IconActionComponent iconComponent = new IconActionComponent( ADD_PREFIX_ICON, ADD_PREFIX_ROLLOVER_ICON, ProjectBundle.message("module.paths.package.prefix.tooltip"), new Runnable() { public void run() { final String message = ProjectBundle.message( "module.paths.package.prefix.prompt", toRelativeDisplayPath(folder.getUrl(), getContentEntry().getUrl() + ":")); final String prefix = Messages.showInputDialog( JavaContentRootPanel.this, message, ProjectBundle.message("module.paths.package.prefix.title"), Messages.getQuestionIcon(), folder.getPackagePrefix(), null); if (prefix != null) { myCallback.setPackagePrefix(folder, prefix); } } }); final JPanel panel = new JPanel(new BorderLayout()); panel.setOpaque(false); panel.add(iconComponent, BorderLayout.CENTER); panel.add(Box.createHorizontalStrut(3), BorderLayout.EAST); return panel; }
private int addValue( final Object extraData, final int row, final DefaultTableModel model, final String desc, final int count, final AnnotatedRowsResult sampleResult) { model.setValueAt(desc, row, 0); if (sampleResult == null || count == 0) { model.setValueAt(count, row, 1); } else { final DCPanel panel = new DCPanel(); panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); final JLabel label = new JLabel(count + ""); final JButton button = WidgetFactory.createSmallButton(IconUtils.ACTION_DRILL_TO_DETAIL); button.addActionListener( new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { drillToGroup(desc, sampleResult); } }); panel.add(label); panel.add(Box.createHorizontalStrut(4)); panel.add(button); model.setValueAt(panel, row, 1); } addExtraValue(extraData, row, model, desc, count, sampleResult); return row + 1; }
/** Builds and lays out the UI. */ private void buildGUI() { setBackground(UIUtilities.BACKGROUND_COLOR); setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); if (selectable) add(checkbox); add(label); JToolBar bar = new JToolBar(); bar.setBackground(UIUtilities.BACKGROUND_COLOR); bar.setFloatable(false); bar.setRollover(true); bar.setBorder(null); bar.setOpaque(true); boolean b = setControlsEnabled(data != null); int count = 0; if (editButton != null) count++; if (unlinkButton != null) count++; if (downloadButton != null) count++; if (infoButton != null) count++; if (openButton != null) count++; if (count > 0 && data != null) { menuButton.setEnabled(true); if (model.isAcrossGroups()) menuButton.setEnabled(false); bar.add(menuButton); if (!b) bar.add(Box.createHorizontalStrut(8)); add(bar); } }
public void initializeGUIComponents() { // Setup Data Panel editButton = new JButton("Edit"); editButton.addActionListener(buttonController); JPanel buttonPanel = new JPanel(); FlowLayout flowLayout = (FlowLayout) buttonPanel.getLayout(); flowLayout.setAlignment(FlowLayout.RIGHT); buttonPanel.add(editButton); buttonPanel.add(Box.createHorizontalStrut(10)); // Setup the Main Panel. setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Skills")); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); // Setup TextField scrollPane = new JScrollPane(); taSkills = new JTextArea(); taSkills.setLineWrap(true); taSkills.setWrapStyleWord(true); taSkills.setEditable(false); scrollPane.setViewportView(taSkills); add(scrollPane); add(buttonPanel); }
@Override public Component getTableCellEditorComponent( JTable table, Object value, boolean isSelected, int row, int column) { cellPanel.removeAll(); TableCellUtilities.setToRowBackground(cellPanel, table, row); cellLabel.setForeground(table.getForeground()); cellLabel.setFont(table.getFont()); if (row == levels.getSize() - 1) { cellLabel.setText(value.toString()); cellPanel.add(cellLabel); cellPanel.add(Box.createHorizontalGlue()); cellPanel.add(removeLevelButton); } else if (row == levels.getSize()) { cellLabel.setText("Add Level"); cellPanel.add(Box.createHorizontalGlue()); cellPanel.add(cellLabel); cellPanel.add(Box.createHorizontalStrut(3)); addLevelButton.setEnabled(classComboBox.getSelectedItem() != null); cellPanel.add(addLevelButton); } else { cellLabel.setText(value.toString()); cellPanel.add(cellLabel); } return cellPanel; }