List of usage examples for javax.swing Box createVerticalBox
public static Box createVerticalBox()
Box
that displays its components from top to bottom. From source file:org.isatools.isacreatorconfigurator.ontologyconfigurationtool.OntologyConfigUI.java
private void createOntologySelectionPanel() { OntologyListRenderer listRenderer = new OntologyListRenderer(); JPanel westPanel = new JPanel(new BorderLayout()); JPanel selectedOntologiesContainer = new JPanel(new BorderLayout()); selectedOntologiesContainer.setOpaque(false); // create List containing selected ontologies selectedOntologyListModel = new DefaultListModel(); selectedOntologyList = new JList(selectedOntologyListModel); selectedOntologyList.setCellRenderer(new SelectedOntologyListRenderer()); selectedOntologyList.setBackground(UIHelper.BG_COLOR); selectedOntologyList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent listSelectionEvent) { setOntologySelectionPanelPlaceholder(infoImage); setSelectedOntologyButtonVisibility(selectedOntologyList.isSelectionEmpty()); }//from ww w. j a v a 2s. c o m }); JScrollPane selectedOntologiesScroller = new JScrollPane(selectedOntologyList, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); selectedOntologiesScroller.setPreferredSize(new Dimension(200, 255)); selectedOntologiesScroller.setBackground(UIHelper.BG_COLOR); selectedOntologiesScroller.getViewport().setBackground(UIHelper.BG_COLOR); IAppWidgetFactory.makeIAppScrollPane(selectedOntologiesScroller); selectedOntologiesContainer.setBorder(new TitledBorder(new RoundedBorder(UIHelper.LIGHT_GREEN_COLOR, 7), "selected ontologies", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR)); selectedOntologiesContainer.add(selectedOntologiesScroller, BorderLayout.CENTER); // ADD BUTTONS removeOntologyButton = new JLabel(removeOntologyButtonIcon); removeOntologyButton.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent mouseEvent) { if (!selectedOntologyList.isSelectionEmpty()) { String ontologyToRemove = selectedOntologyList.getSelectedValue().toString(); System.out.println("Removing " + ontologyToRemove); selectedOntologies.remove(ontologyToRemove); setOntologySelectionPanelPlaceholder(infoImage); updateSelectedOntologies(); } removeOntologyButton.setIcon(removeOntologyButtonIcon); } @Override public void mouseEntered(MouseEvent mouseEvent) { removeOntologyButton.setIcon(removeOntologyButtonIconOver); } @Override public void mouseExited(MouseEvent mouseEvent) { removeOntologyButton.setIcon(removeOntologyButtonIcon); } }); removeOntologyButton.setVisible(false); viewOntologyButton = new JLabel(browseOntologyButtonIcon); viewOntologyButton.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent mouseEvent) { performTransition(); viewOntologyButton.setIcon(browseOntologyButtonIcon); } @Override public void mouseEntered(MouseEvent mouseEvent) { viewOntologyButton.setIcon(browseOntologyButtonIconOver); } @Override public void mouseExited(MouseEvent mouseEvent) { viewOntologyButton.setIcon(browseOntologyButtonIcon); } }); viewOntologyButton.setVisible(false); removeRestrictionButton = new JLabel(removeRestrictionButtonIcon); removeRestrictionButton.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent mouseEvent) { if (!selectedOntologyList.isSelectionEmpty()) { ((RecommendedOntology) selectedOntologyList.getSelectedValue()).setBranchToSearchUnder(null); removeRestrictionButton.setVisible(false); selectedOntologyList.repaint(); } removeRestrictionButton.setIcon(removeRestrictionButtonIcon); } @Override public void mouseEntered(MouseEvent mouseEvent) { removeRestrictionButton.setIcon(removeRestrictionButtonIconOver); } @Override public void mouseExited(MouseEvent mouseEvent) { removeRestrictionButton.setIcon(removeRestrictionButtonIcon); } }); removeRestrictionButton.setVisible(false); Box selectedOntologiesOptionContainer = Box.createHorizontalBox(); selectedOntologiesOptionContainer.setOpaque(false); selectedOntologiesOptionContainer.add(removeOntologyButton); selectedOntologiesOptionContainer.add(viewOntologyButton); selectedOntologiesOptionContainer.add(removeRestrictionButton); selectedOntologiesContainer.add(selectedOntologiesOptionContainer, BorderLayout.SOUTH); // create panel populated with all available ontologies inside a filterable list! JPanel availableOntologiesListContainer = new JPanel(new BorderLayout()); availableOntologiesListContainer .setBorder(new TitledBorder(new RoundedBorder(UIHelper.LIGHT_GREEN_COLOR, 7), "available ontologies", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR)); final ExtendedJList availableOntologies = new ExtendedJList(listRenderer); final JLabel addOntologyButton = new JLabel(addOntologyButtonIcon); addOntologyButton.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent mouseEvent) { if (!availableOntologies.isSelectionEmpty()) { Ontology ontology = (Ontology) availableOntologies.getSelectedValue(); selectedOntologies.put(ontology.getOntologyDisplayLabel(), new RecommendedOntology(ontology)); updateSelectedOntologies(); setOntologySelectionPanelPlaceholder(infoImage); } addOntologyButton.setIcon(addOntologyButtonIcon); } @Override public void mouseEntered(MouseEvent mouseEvent) { addOntologyButton.setIcon(addOntologyButtonIconOver); } @Override public void mouseExited(MouseEvent mouseEvent) { addOntologyButton.setIcon(addOntologyButtonIcon); } }); final JLabel info = UIHelper.createLabel("", UIHelper.VER_10_PLAIN, UIHelper.DARK_GREEN_COLOR); availableOntologies.addPropertyChangeListener("update", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent propertyChangeEvent) { info.setText("<html>viewing <b>" + availableOntologies.getFilteredItems().size() + "</b> ontologies</html>"); } }); Box optionsBox = Box.createVerticalBox(); optionsBox.add(UIHelper.wrapComponentInPanel(info)); Box availableOntologiesOptionBox = Box.createHorizontalBox(); availableOntologiesOptionBox.add(addOntologyButton); availableOntologiesOptionBox.add(Box.createHorizontalGlue()); optionsBox.add(availableOntologiesOptionBox); availableOntologiesListContainer.add(optionsBox, BorderLayout.SOUTH); if (ontologiesToBrowseOn == null) { ontologiesToBrowseOn = new ArrayList<Ontology>(); List<Ontology> bioportalQueryResult = bioportalClient.getAllOntologies(); if (bioportalQueryResult != null) { ontologiesToBrowseOn.addAll(bioportalQueryResult); } ontologiesToBrowseOn.addAll(olsClient.getAllOntologies()); } // precautionary check in case of having no ontologies available to search on. if (ontologiesToBrowseOn != null) { for (Ontology o : ontologiesToBrowseOn) { availableOntologies.addItem(o); } } info.setText( "<html>viewing <b>" + availableOntologies.getFilteredItems().size() + "</b> ontologies</html>"); // need to get ontologies available from bioportal and add them here. JScrollPane availableOntologiesScroller = new JScrollPane(availableOntologies, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); availableOntologiesScroller.getViewport().setBackground(UIHelper.BG_COLOR); availableOntologiesScroller.setPreferredSize(new Dimension(200, 125)); availableOntologiesScroller.setBorder(new EmptyBorder(0, 0, 0, 0)); IAppWidgetFactory.makeIAppScrollPane(availableOntologiesScroller); availableOntologiesListContainer.add(availableOntologiesScroller); availableOntologiesListContainer.add(availableOntologies.getFilterField(), BorderLayout.NORTH); westPanel.add(selectedOntologiesContainer, BorderLayout.CENTER); westPanel.add(availableOntologiesListContainer, BorderLayout.SOUTH); add(westPanel, BorderLayout.WEST); }
From source file:org.jannocessor.ui.RenderPreviewDialog.java
private void initialize() { logger.debug("Initializing UI..."); DefaultSyntaxKit.initKit();//from w ww. ja v a2 s . co m JEditorPane.registerEditorKitForContentType("text/java_template", "org.jannocessor.syntax.JavaTemplateKit", getClass().getClassLoader()); JEditorPane.registerEditorKitForContentType("text/java_output", "org.jannocessor.syntax.JavaOutputKit", getClass().getClassLoader()); setTitle("JAnnocessor - Java Annotation Processor"); setLayout(new BorderLayout(5, 5)); listFiles(); Toolkit tk = Toolkit.getDefaultToolkit(); Dimension screenSize = tk.getScreenSize(); double width = screenSize.getWidth() * 0.9; double height = screenSize.getHeight() * 0.8; // Font font = new Font("Courier New", Font.PLAIN, 14); input = createInput(); JScrollPane scroll1 = new JScrollPane(input, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); input.setContentType("text/java_template"); input.setText(""); scroll1.setMinimumSize(new Dimension(200, 200)); scroll1.setPreferredSize(new Dimension((int) (width * 0.5), (int) height)); add(scroll1, BorderLayout.CENTER); output = Box.createVerticalBox(); scroll2 = new JScrollPane(output, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scroll2.setMinimumSize(new Dimension(200, 200)); scroll2.setPreferredSize(new Dimension((int) (width * 0.5), (int) height)); add(scroll2, BorderLayout.EAST); combo = createCombo(); combo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { load((File) combo.getSelectedItem()); } }); add(combo, BorderLayout.NORTH); JLabel help = new JLabel( " Choose a template from the drop-down box to edit it. Navigation: Alt + Left & Alt + Right; Refresh = F5, Close = Esc", JLabel.CENTER); help.setForeground(Color.WHITE); help.setBackground(Color.BLACK); help.setOpaque(true); help.setFont(new Font("Courier New", Font.BOLD, 14)); add(help, BorderLayout.SOUTH); keyListener = new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_F5) { e.consume(); processElements(); refresh(); } else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { e.consume(); dispose(); } else if (e.getKeyCode() == KeyEvent.VK_LEFT && e.isAltDown()) { e.consume(); moveBackward(); } else if (e.getKeyCode() == KeyEvent.VK_RIGHT && e.isAltDown()) { e.consume(); moveForward(); } else if (e.getKeyCode() == KeyEvent.VK_S && e.isControlDown()) { e.consume(); save(); } else if (e.getKeyCode() == KeyEvent.VK_I && e.isControlDown()) { e.consume(); increase(); } else if (e.getKeyCode() == KeyEvent.VK_D && e.isControlDown()) { e.consume(); decrease(); } } }; input.addKeyListener(keyListener); combo.addKeyListener(keyListener); setActive(0); pack(); setModal(true); setLocationRelativeTo(null); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); input.requestFocus(); logger.debug("Initialized UI."); }
From source file:org.jannocessor.ui.RenderPreviewDialog.java
private JComponent createOutput(String title, String content) { editor = new JEditorPane(); JScrollPane scroll = new JScrollPane(editor, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scroll.setMinimumSize(new Dimension(100, 100)); editor.setContentType("text/java_output"); editor.setEditable(false);//w w w . j a v a 2 s. co m editor.setText(content); editor.addKeyListener(keyListener); JLabel header = new JLabel(title); Box box = Box.createVerticalBox(); box.add(header); box.add(scroll); return box; }
From source file:org.jcurl.demo.editor.EditorApp.java
public EditorApp() { addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { EditorApp.this.cmdExit(); }/*from w w w. j av a 2s . co m*/ }); master = new RockEditDisplay(); master.setPos(mod_locations); master.setSpeed(mod_speeds); final PositionDisplay pnl2 = new PositionDisplay(); pnl2.setPos(mod_locations); pnl2.setZoom(Zoomer.HOG2HACK); final Container con = getContentPane(); con.add(master, "Center"); con.add(new SumWaitDisplay(mod_locations), "West"); con.add(new SumShotDisplay(mod_locations), "East"); { final Box b0 = Box.createVerticalBox(); final Box b1 = Box.createHorizontalBox(); b1.add(Box.createRigidArea(new Dimension(0, 75))); b1.add(pnl2); b0.add(b1); b0.add(new JSlider(0, 100, 0)); final Box b2 = Box.createHorizontalBox(); b2.add(Box.createHorizontalGlue()); b2.add(bStart = this.newButton("Start", this, "cmdRunStart")); b2.add(bPause = this.newButton("Pause", this, "cmdRunPause")); b2.add(bStop = this.newButton("Stop", this, "cmdRunStop")); b2.add(Box.createHorizontalGlue()); b0.add(b2); con.add(b0, "South"); } bStop.getAction().actionPerformed(null); setJMenuBar(createMenu()); refreshTitle(); this.setSize(900, 400); new SpeedController(mod_locations, mod_speeds, master); new LocationController(mod_locations, pnl2); lastSaved = mod_locations.getLastChanged(); }
From source file:org.jcurl.demo.smack.JCurlSmackClient.java
@Override protected void startup() { getMainFrame().setJMenuBar(createMenuBar()); miRoster.setSelected(true);/* ww w .j a va 2s .c o m*/ final JComponent pv = new JPanel(); pv.setLayout(new BorderLayout()); final Box conversation = Box.createVerticalBox(); pv.add(new JScrollPane(conversation, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), BorderLayout.CENTER); pv.add(new JScrollPane(sca, ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS), BorderLayout.SOUTH); final JSplitPane ph = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); ph.setResizeWeight(0.8); ph.add(pv, JSplitPane.LEFT); ph.add(new JScrollPane(sro), JSplitPane.RIGHT); xmppRoster(); show(ph); // connect the jabber account new Thread(new Runnable() { public void run() { try { // get uid + pwd from a .properties file final Properties p = loadClassProps(JCurlSmackClient.class, null); acc.setUid(XmppAddress.parse(p.getProperty("acc_uid"))); acc.setPwd(p.getProperty("acc_pwd")); // login and get the present buddies acc.login(resource); SwingUtilities.invokeLater(new Runnable() { public void run() { sro.setConn(acc.getConn()); // Wire up xmpp stuff: final ChatManager cm = sro.getChatManager(); cm.addChatListener(sca); cm.addChatListener(slo); } }); } catch (final IOException e) { throw new RuntimeException("Unhandled", e); } catch (final XMPPException e) { throw new RuntimeException("Unhandled", e); } } }).start(); }
From source file:org.jcurl.demo.tactics.BroomPromptSwingBean.java
public BroomPromptSwingBean() { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); final Box b = Box.createVerticalBox(); {// w w w . j av a2s . c o m final JPanel tb = new JPanel(); tb.setLayout(new BoxLayout(tb, BoxLayout.X_AXIS)); tb.setBorder(BorderFactory.createTitledBorder("Active")); tb.add(rock = new JComboBox(new Object[] { 1, 2, 3, 4, 5, 6, 7, 8 })); rock.setPrototypeDisplayValue(8); rock.addItemListener(this); dark = new JRadioButton("dark"); dark.addActionListener(this); light = new JRadioButton("light"); light.addActionListener(this); final ButtonGroup bg = new ButtonGroup(); bg.add(dark); bg.add(light); tb.add(dark); tb.add(light); b.add(tb); } { final JPanel tb = new JPanel(); tb.setLayout(new BoxLayout(tb, BoxLayout.X_AXIS)); tb.setBorder(BorderFactory.createTitledBorder("Handle")); in = new JRadioButton("In Turn"); in.addActionListener(this); out = new JRadioButton("Out Turn"); out.addActionListener(this); final ButtonGroup bg = new ButtonGroup(); bg.add(in); bg.add(out); tb.add(out); tb.add(in); tb.add(Box.createHorizontalGlue()); b.add(tb); } { final JPanel tb = new JPanel(); tb.setLayout(new BoxLayout(tb, BoxLayout.X_AXIS)); tb.setBorder(BorderFactory.createTitledBorder("Split Time")); if (UseJSpinnerBoundedRange) { split2 = new JSpinnerBoundedRange(); split2.addFocusListener(this); split = null; } else { split2 = null; split = new JSpinner(); // log.info(split.getEditor().getClass().getName()); split.addFocusListener(this); final JSpinner.NumberEditor ed = (JSpinner.NumberEditor) split.getEditor(); ed.addFocusListener(this); ed.getTextField().addFocusListener(this); } tb.add(split2); tb.add(dt = new JComboBox(new Object[] { "1/1000 sec", "1/100 sec", "1/10 sec", "sec" })); tb.add(Box.createHorizontalGlue()); b.add(tb); dt.setEnabled(false); } { final JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); p.setBorder(BorderFactory.createTitledBorder("Broom Position")); { x = new JSpinnerNumberUnit(); x.setLabel("x: "); x.setBase(Unit.METER); x.setChoose(Unit.FOOT, Unit.INCH, Unit.CENTIMETER, Unit.METER); x.setModel(new SpinnerNumberModel(0.0, -IceSize.SIDE_2_CENTER, IceSize.SIDE_2_CENTER, 0.1)); x.addChangeListener(this); x.addPropertyChangeListener(this); p.add(x); } { y = new JSpinnerNumberUnit(); y.setLabel("y: "); y.setBase(Unit.METER); y.setChoose(Unit.FOOT, Unit.INCH, Unit.CENTIMETER, Unit.METER); y.setModel(new SpinnerNumberModel(0.0, -IceSize.BACK_2_TEE, IceSize.HOG_2_TEE, 0.1)); y.addChangeListener(this); y.addPropertyChangeListener(this); p.add(y); } b.add(p); } this.add(b); }
From source file:org.jcurl.demo.tactics.CurlerSwingBean.java
public CurlerSwingBean() { setLayout(new BorderLayout()); final Box b = Box.createVerticalBox(); {/* ww w. ja va 2s .co m*/ final JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); p.setBorder(BorderFactory.createTitledBorder("Curl Model")); p.add(curlers = new JComboBox(findCurlers())); b.add(p); } { final JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); p.setBorder(BorderFactory.createTitledBorder("Draw-To-Tee")); { time = new JSpinnerNumberUnit(); time.setLabel("time: "); time.setBase(Unit.SECOND); time.setModel(new SpinnerNumberModel(24.0, 17.0, 28.0, 0.1)); time.addPropertyChangeListener(this); time.addChangeListener(this); p.add(time); } { curl = new JSpinnerNumberUnit(); curl.setLabel("curl: "); curl.setBase(Unit.METER); curl.setChoose(Unit.FOOT, Unit.INCH, Unit.CENTIMETER, Unit.METER); curl.setModel(new SpinnerNumberModel(1.0, 0.0, 3.0, 0.1)); curl.addPropertyChangeListener(this); curl.addChangeListener(this); p.add(curl); } b.add(p); } add(b, BorderLayout.NORTH); add(new JLabel("TODO: other settings"), BorderLayout.CENTER); setEnabled(false); }
From source file:org.jcurl.demo.tactics.TacticsApp.java
public TacticsApp() { addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { TacticsApp.this.cmdExit(); }/*from w ww . ja v a 2s.c o m*/ }); master = new RockEditDisplay(); master.setPos(mod_locations); master.setSpeed(mod_speeds); final PositionDisplay pnl2 = new PositionDisplay(); pnl2.setPos(mod_locations); pnl2.setZoom(Zoomer.HOG2HACK); final Container con = getContentPane(); { final JPanel p = new JPanel(new BorderLayout()); p.add(new SumWaitDisplay(mod_locations), "West"); p.add(master, "Center"); p.add(new SumShotDisplay(mod_locations), "East"); con.add(p, "Center"); } // con.add(new SumWaitDisplay(mod_locations), "West"); con.add(new SumOutDisplay(mod_locations), "West"); { final Box b1 = Box.createHorizontalBox(); b1.add(Box.createRigidArea(new Dimension(0, 75))); b1.add(pnl2); con.add(b1, "South"); } final JTabbedPane t = new JTabbedPane(); con.add(t, "East"); { final Box b0 = Box.createHorizontalBox(); t.add("Rock", b0); { final JPanel b1 = new JPanel(new BorderLayout()); final Box b2 = Box.createVerticalBox(); b2.add(new JComboBox(new String[] { "Dark", "Light" })); b2.add(new JLabel("Broom", SwingConstants.LEFT)); b1.add(b2, "North"); JSlider s = new JSlider(-2000, 2000, 0); s.setOrientation(SwingConstants.VERTICAL); s.setMajorTickSpacing(1000); s.setMinorTickSpacing(100); s.setPaintLabels(true); s.setPaintTicks(true); b1.add(s, "Center"); final Box b3 = Box.createHorizontalBox(); b3.add(new JFormattedTextField()); b3.add(new JLabel("mm", SwingConstants.LEFT)); b1.add(b3, "South"); b0.add(b1); } { final JPanel b1 = new JPanel(new BorderLayout()); final Box b2 = Box.createVerticalBox(); b2.add(new JComboBox(new String[] { "1", "2", "3", "4", "5", "6", "7", "8" })); b2.add(new JLabel("Splittime", SwingConstants.LEFT)); b1.add(b2, "North"); JSlider s = new JSlider(500, 2500, 1500); s.setOrientation(SwingConstants.VERTICAL); s.setMajorTickSpacing(1000); s.setMinorTickSpacing(100); s.setPaintLabels(true); s.setPaintTicks(true); b1.add(s, "Center"); final Box b3 = Box.createHorizontalBox(); b3.add(new JSpinner()); b3.add(new JLabel("ms", SwingConstants.LEFT)); b1.add(b3, "South"); b0.add(b1); } } { final Box b0 = Box.createHorizontalBox(); t.add("Ice", b0); { final JPanel b1 = new JPanel(new BorderLayout()); b1.add(new JLabel("Curl"), "North"); JSlider s = new JSlider(0, 5000, 0); s.setOrientation(SwingConstants.VERTICAL); s.setMajorTickSpacing(1000); s.setMinorTickSpacing(100); s.setPaintLabels(true); s.setPaintTicks(true); b1.add(s, "Center"); final JSpinner s1 = new JSpinner(); b1.add(s1, "South"); b0.add(b1); } { final JPanel b1 = new JPanel(new BorderLayout()); b1.add(new JLabel("DrawToTee"), "North"); JSlider s = new JSlider(15000, 30000, 25000); s.setOrientation(SwingConstants.VERTICAL); s.setMajorTickSpacing(5000); s.setMinorTickSpacing(1000); s.setPaintLabels(true); s.setPaintTicks(true); b1.add(s, "Center"); final JSpinner s1 = new JSpinner(); b1.add(s1, "South"); b0.add(b1); } } setJMenuBar(createMenu()); refreshTitle(); this.setSize(900, 400); new SpeedController(mod_locations, mod_speeds, master); new LocationController(mod_locations, pnl2); lastSaved = mod_locations.getLastChanged(); }
From source file:org.kepler.gui.DialogGeneralTab.java
/** * getBottomPanel/*w w w . j a va 2 s . c om*/ * * @return Component */ protected Component getBottomPanel() { final Box bottomPanel = Box.createVerticalBox(); final Border bottomPanelTitledBorder = BorderFactory.createTitledBorder( StaticResources.getDisplayString("dialogs." + _targetType + ".general.NamesNotesBorderTitle", "")); bottomPanel.setBorder(bottomPanelTitledBorder); cbName = new JCheckBox( StaticResources.getDisplayString("dialogs." + _targetType + ".general.showNameCheckbox", "")); cbNotes = new JCheckBox( StaticResources.getDisplayString("dialogs." + _targetType + ".general.showNoteCheckbox", "")); cbPorts = new JCheckBox( StaticResources.getDisplayString("dialogs." + _targetType + ".general.showPortNamesCheckbox", "")); bottomPanel.add(cbName); bottomPanel.add(cbNotes); bottomPanel.add(cbPorts); return bottomPanel; }
From source file:org.neuroph.netbeans.main.easyneurons.NeuralGraphRenderer.java
/** * @param jp/*from ww w .j a v a 2 s .co m*/ * panel to which controls will be added */ protected void addControls(final JPanel jp) { final JPanel control_panel = new JPanel(); jp.add(control_panel, BorderLayout.EAST); control_panel.setLayout(new GridBagLayout()); java.awt.GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 5); gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; // control_panel.setBackground(new Color(00, 255, 00)); final Box vertex_panel = Box.createVerticalBox(); vertex_panel.setBorder(BorderFactory.createTitledBorder("Neurons")); final Box edge_panel = Box.createVerticalBox(); edge_panel.setBorder(BorderFactory.createTitledBorder("Connections")); final Box edges_and_vertex_panel = Box.createVerticalBox(); // Box zoom_and_mode_panel = Box.createVerticalBox(); // zoom_and_mode_panel.setBorder(BorderFactory.createTitledBorder("Other controls")); // final Box layout_panel = Box.createVerticalBox(); // layout_panel.setBorder(BorderFactory.createTitledBorder("Layout")); // JPanel zoom_and_mode_panel = new JPanel(); // zoom_and_mode_panel.setLayout(new GridBagLayout() ); // //GridLayout(3,1) // zoom_and_mode_panel.setBackground(new Color(0,255,0)); edges_and_vertex_panel.add(vertex_panel); edges_and_vertex_panel.add(edge_panel); // edges_and_vertex_panel.add(layout_panel); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; control_panel.add(edges_and_vertex_panel, gridBagConstraints); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; // control_panel.add(layout_panel, gridBagConstraints); // originalni layout // control_panel.add(vertex_panel, BorderLayout.WEST); // control_panel.add(edge_panel, BorderLayout.EAST); // control_panel.add(edges_and_vertex_panel, BorderLayout.CENTER); // set up vertex controls v_color = new JCheckBox("vertex seed coloring"); v_color.addActionListener(this); // v_stroke = new JCheckBox("<html>stroke highlight selected</html>"); // v_stroke.addActionListener(this); v_shape = new JCheckBox("vertex degree shapes"); v_shape.addActionListener(this); v_size = new JCheckBox("activation size"); v_size.addActionListener(this); v_size.setSelected(false); v_aspect = new JCheckBox("vertex degree ratio stretch"); v_aspect.addActionListener(this); v_small = new JCheckBox("filter vertices of degree < " + VertexDisplayPredicate.MIN_DEGREE); v_small.addActionListener(this); // vertex_panel.add(v_color); vertex_panel.add(v_labels); // vertex_panel.add(v_shape); vertex_panel.add(v_size); // vertex_panel.add(v_aspect); // vertex_panel.add(v_small); // vertex_panel.add(v_stroke); // set up edge controls // JPanel gradient_panel = new JPanel(new GridLayout(1, 0)); // gradient_panel.setBorder(BorderFactory.createTitledBorder("Edge paint")); // no_gradient = new JRadioButton("Solid color"); // no_gradient.addActionListener(this); // no_gradient.setSelected(true); // // gradient_absolute = new JRadioButton("Absolute gradient"); // // gradient_absolute.addActionListener(this); // gradient_relative = new JRadioButton("Gradient"); // gradient_relative.addActionListener(this); // ButtonGroup bg_grad = new ButtonGroup(); // bg_grad.add(no_gradient); // bg_grad.add(gradient_relative); // //bg_grad.add(gradient_absolute); // gradient_panel.add(no_gradient); // //gradientGrid.add(gradient_absolute); // gradient_panel.add(gradient_relative); // JPanel shape_panel = new JPanel(new GridLayout(3, 2)); // shape_panel.setBorder(BorderFactory // .createTitledBorder("Connection shape")); // e_line = new JRadioButton("line"); // e_line.addActionListener(this); // e_line.setSelected(true); // // e_bent = new JRadioButton("bent line"); // // e_bent.addActionListener(this); // e_wedge = new JRadioButton("wedge"); // e_wedge.addActionListener(this); // e_quad = new JRadioButton("quad curve"); // e_quad.addActionListener(this); // e_cubic = new JRadioButton("cubic curve"); // e_cubic.addActionListener(this); // ButtonGroup bg_shape = new ButtonGroup(); // bg_shape.add(e_line); // // bg.add(e_bent); // bg_shape.add(e_wedge); // bg_shape.add(e_quad); // bg_shape.add(e_cubic); // shape_panel.add(e_line); // // shape_panel.add(e_bent); // // shape_panel.add(e_wedge); // shape_panel.add(e_quad); // shape_panel.add(e_cubic); // // fill_edges = new JCheckBox("fill edge shapes"); // // fill_edges.setSelected(false); // // fill_edges.addActionListener(this); // // shape_panel.add(fill_edges); // shape_panel.setOpaque(true); e_color = new JCheckBox("weight highlighting"); e_color.addActionListener(this); e_uarrow_pred = new JCheckBox("undirected"); e_uarrow_pred.addActionListener(this); e_darrow_pred = new JCheckBox("directed"); e_darrow_pred.addActionListener(this); e_darrow_pred.setSelected(true); // JPanel arrow_panel = new JPanel(new GridLayout(1,0)); // arrow_panel.setBorder(BorderFactory.createTitledBorder("Show arrows")); // arrow_panel.add(e_uarrow_pred); // arrow_panel.add(e_darrow_pred); e_show_d = new JCheckBox("directed"); e_show_d.addActionListener(this); e_show_d.setSelected(true); e_show_u = new JCheckBox("undirected"); e_show_u.addActionListener(this); e_show_u.setSelected(true); JPanel show_edge_panel = new JPanel(new GridLayout(1, 0)); show_edge_panel.setBorder(BorderFactory.createTitledBorder("Show edges")); show_edge_panel.add(e_show_u); show_edge_panel.add(e_show_d); // shape_panel.setAlignmentX(Component.LEFT_ALIGNMENT); // edge_panel.add(shape_panel); // gradient_panel.setAlignmentX(Component.LEFT_ALIGNMENT); // edge_panel.add(gradient_panel); // show_edge_panel.setAlignmentX(Component.LEFT_ALIGNMENT); // edge_panel.add(show_edge_panel); // arrow_panel.setAlignmentX(Component.LEFT_ALIGNMENT); // edge_panel.add(arrow_panel); e_color.setAlignmentX(Component.LEFT_ALIGNMENT); edge_panel.add(e_color); e_labels.setAlignmentX(Component.LEFT_ALIGNMENT); edge_panel.add(e_labels); // Class<?>[] combos = getLayoutOptions(); // final JComboBox layoutCombo = new JComboBox(combos); // // use a renderer to shorten the layout name presentation // layoutCombo.setRenderer(new DefaultListCellRenderer() { // public Component getListCellRendererComponent(JList list, // Object value, int index, boolean isSelected, // boolean cellHasFocus) { // String valueString = value.toString(); // valueString = valueString.substring(valueString // .lastIndexOf('.') + 1); // return super.getListCellRendererComponent(list, valueString, // index, isSelected, cellHasFocus); // } // }); // layoutCombo.addActionListener(new LayoutChooser(layoutCombo, vv)); //// UNDO: layoutCombo.setSelectedItem(FRLayout.class); // layout_panel.add(layoutCombo); // set up zoom controls zoom_at_mouse = new JCheckBox("<html><center>zoom at mouse<p>(wheel only)</center></html>"); zoom_at_mouse.addActionListener(this); final ScalingControl scaler = new CrossoverScalingControl(); JButton plus = new JButton("+"); plus.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1.1f, vv.getCenter()); } }); JButton minus = new JButton("-"); minus.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1 / 1.1f, vv.getCenter()); } }); JPanel zoomPanel = new JPanel(); zoomPanel.setAlignmentX(Component.RIGHT_ALIGNMENT); zoomPanel.setBorder(BorderFactory.createTitledBorder("Zoom")); zoomPanel.add(plus); zoomPanel.add(minus); gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 5); gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; JComboBox modeBox = graphMouse.getModeComboBox(); modeBox.setAlignmentX(Component.RIGHT_ALIGNMENT); JPanel modePanel = new JPanel(new BorderLayout()) { @Override public Dimension getMaximumSize() { return getPreferredSize(); } }; modePanel.setBorder(BorderFactory.createTitledBorder("Mouse Mode")); modePanel.add(modeBox); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; control_panel.add(modePanel, gridBagConstraints); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; control_panel.add(zoomPanel, gridBagConstraints); // add font control to center panel font = new JCheckBox("bold text"); font.addActionListener(this); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; control_panel.add(font, gridBagConstraints); }