Java Code Examples for javax.swing.Box#createVerticalBox()
The following examples show how to use
javax.swing.Box#createVerticalBox() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SearchPanel.java From HubPlayer with GNU General Public License v3.0 | 7 votes |
private void createLayout() { Box Box1 = Box.createHorizontalBox(); Box1.add(Box.createHorizontalStrut(10)); Box1.add(userButton); Box1.add(Box.createHorizontalStrut(20)); Box1.add(textField); Box1.add(Box.createHorizontalStrut(5)); Box1.add(searchButton); Box1.add(Box.createHorizontalStrut(10)); Box Box2 = Box.createVerticalBox(); Box2.add(Box.createVerticalStrut(7)); Box2.add(Box1); Box2.add(Box.createVerticalStrut(5)); add(Box2, BorderLayout.NORTH); add(hubToolBar, BorderLayout.CENTER); }
Example 2
Source File: Test4903007.java From jdk8u_jdk with GNU General Public License v2.0 | 7 votes |
protected JPanel getObject() { Box vBox = Box.createVerticalBox(); vBox.add(new JButton("button")); vBox.add(Box.createVerticalStrut(10)); vBox.add(new JLabel("label")); vBox.add(Box.createVerticalGlue()); vBox.add(new JButton("button")); vBox.add(Box.createVerticalStrut(10)); vBox.add(new JLabel("label")); Box hBox = Box.createHorizontalBox(); hBox.add(new JButton("button")); hBox.add(Box.createHorizontalStrut(10)); hBox.add(new JLabel("label")); hBox.add(Box.createHorizontalGlue()); hBox.add(new JButton("button")); hBox.add(Box.createHorizontalStrut(10)); hBox.add(new JLabel("label")); JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(vBox); panel.add(Box.createGlue()); panel.add(hBox); return panel; }
Example 3
Source File: ExplorationCustomInfoPanel.java From mars-sim with GNU General Public License v3.0 | 6 votes |
/** * Constructor. */ public ExplorationCustomInfoPanel() { // Use JPanel constructor super(); setLayout(new BorderLayout()); // Create the main scroll panel. WebScrollPane mainScrollPane = new WebScrollPane(); add(mainScrollPane, BorderLayout.NORTH); // Create main panel. mainPane = Box.createVerticalBox(); mainScrollPane.setViewportView(mainPane); sitePanes = new HashMap<String, ExplorationSitePanel>(5); }
Example 4
Source File: Test4903007.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
protected JPanel getObject() { Box vBox = Box.createVerticalBox(); vBox.add(new JButton("button")); vBox.add(Box.createVerticalStrut(10)); vBox.add(new JLabel("label")); vBox.add(Box.createVerticalGlue()); vBox.add(new JButton("button")); vBox.add(Box.createVerticalStrut(10)); vBox.add(new JLabel("label")); Box hBox = Box.createHorizontalBox(); hBox.add(new JButton("button")); hBox.add(Box.createHorizontalStrut(10)); hBox.add(new JLabel("label")); hBox.add(Box.createHorizontalGlue()); hBox.add(new JButton("button")); hBox.add(Box.createHorizontalStrut(10)); hBox.add(new JLabel("label")); JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(vBox); panel.add(Box.createGlue()); panel.add(hBox); return panel; }
Example 5
Source File: WaitDialog.java From gate-core with GNU Lesser General Public License v3.0 | 6 votes |
/** */ void jbInit() throws Exception { JPanel centerPanel = new JPanel(); centerBox = Box.createVerticalBox(); centerPanel.setLayout(borderLayout1); //centerPanel.setBorder(new LineBorder(Color.darkGray, 2)); // centerPanel.setBackground(Color.white); // centerBox.setBackground(Color.white); picture = new JLabel(icon); picture.setOpaque(false); centerPanel.add(centerBox, BorderLayout.CENTER); centerPanel.add(picture, BorderLayout.WEST); centerPanel.add(Box.createVerticalStrut(5), BorderLayout.NORTH); centerPanel.add(Box.createVerticalStrut(5), BorderLayout.SOUTH); centerPanel.add(Box.createHorizontalStrut(8), BorderLayout.EAST); getContentPane().add(centerPanel, BorderLayout.CENTER); centerPanel.setOpaque(false); }
Example 6
Source File: Test4903007.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
protected JPanel getObject() { Box vBox = Box.createVerticalBox(); vBox.add(new JButton("button")); vBox.add(Box.createVerticalStrut(10)); vBox.add(new JLabel("label")); vBox.add(Box.createVerticalGlue()); vBox.add(new JButton("button")); vBox.add(Box.createVerticalStrut(10)); vBox.add(new JLabel("label")); Box hBox = Box.createHorizontalBox(); hBox.add(new JButton("button")); hBox.add(Box.createHorizontalStrut(10)); hBox.add(new JLabel("label")); hBox.add(Box.createHorizontalGlue()); hBox.add(new JButton("button")); hBox.add(Box.createHorizontalStrut(10)); hBox.add(new JLabel("label")); JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(vBox); panel.add(Box.createGlue()); panel.add(hBox); return panel; }
Example 7
Source File: Test4903007.java From hottub with GNU General Public License v2.0 | 6 votes |
protected JPanel getObject() { Box vBox = Box.createVerticalBox(); vBox.add(new JButton("button")); vBox.add(Box.createVerticalStrut(10)); vBox.add(new JLabel("label")); vBox.add(Box.createVerticalGlue()); vBox.add(new JButton("button")); vBox.add(Box.createVerticalStrut(10)); vBox.add(new JLabel("label")); Box hBox = Box.createHorizontalBox(); hBox.add(new JButton("button")); hBox.add(Box.createHorizontalStrut(10)); hBox.add(new JLabel("label")); hBox.add(Box.createHorizontalGlue()); hBox.add(new JButton("button")); hBox.add(Box.createHorizontalStrut(10)); hBox.add(new JLabel("label")); JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(vBox); panel.add(Box.createGlue()); panel.add(hBox); return panel; }
Example 8
Source File: ProgramEditor.java From FancyBing with GNU General Public License v3.0 | 6 votes |
private JTextField createEntry(String labelText, int cols, String text, boolean editable) { JComponent label = createEntryLabel(labelText); m_panelLeft.add(label); Box box = Box.createVerticalBox(); JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); box.add(Box.createVerticalGlue()); box.add(panel); box.add(Box.createVerticalGlue()); JTextField field = new JTextField(cols); field.setText(text); if (! editable) GuiUtil.setEditableFalse(field); panel.add(field); m_panelRight.add(box); return field; }
Example 9
Source File: Test4903007.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
protected JPanel getObject() { Box vBox = Box.createVerticalBox(); vBox.add(new JButton("button")); vBox.add(Box.createVerticalStrut(10)); vBox.add(new JLabel("label")); vBox.add(Box.createVerticalGlue()); vBox.add(new JButton("button")); vBox.add(Box.createVerticalStrut(10)); vBox.add(new JLabel("label")); Box hBox = Box.createHorizontalBox(); hBox.add(new JButton("button")); hBox.add(Box.createHorizontalStrut(10)); hBox.add(new JLabel("label")); hBox.add(Box.createHorizontalGlue()); hBox.add(new JButton("button")); hBox.add(Box.createHorizontalStrut(10)); hBox.add(new JLabel("label")); JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(vBox); panel.add(Box.createGlue()); panel.add(hBox); return panel; }
Example 10
Source File: MultipleAlignmentGUI.java From biojava with GNU Lesser General Public License v2.1 | 5 votes |
protected MultipleAlignmentGUI() { super(); thread = null; JMenuBar menu = MenuCreator.initAlignmentGUIMenu(this); this.setJMenuBar(menu); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setTitle(MAIN_TITLE); tab = new SelectMultiplePanel(); // setup tabPane tabPane = new JTabbedPane(); tabPane.addTab("Select Structures", null, tab, "Input Structure identifiers"); Box hBoxPair = setupPairwiseAlgorithm(); Box hBoxMult = setupMultipleAlgorithm(); Box vBox = Box.createVerticalBox(); vBox.add(tabPane); vBox.add(Box.createGlue()); Box vBoxMain = Box.createVerticalBox(); vBoxMain.add(hBoxPair); vBoxMain.add(hBoxMult); vBoxMain.add(tabPane); vBoxMain.add(initButtons()); this.getContentPane().add(vBoxMain); this.pack(); this.setVisible(true); }
Example 11
Source File: DisplayAFP.java From biojava with GNU Lesser General Public License v2.1 | 5 votes |
public static void showAlignmentPanel(AFPChain afpChain, Atom[] ca1, Atom[] ca2, AbstractAlignmentJmol jmol) throws StructureException { AligPanel me = new AligPanel(); me.setAlignmentJmol(jmol); me.setAFPChain(afpChain); me.setCa1(ca1); me.setCa2(ca2); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setTitle(afpChain.getName1() + " vs. " + afpChain.getName2() + " | " + afpChain.getAlgorithmName() + " V. " + afpChain.getVersion()); me.setPreferredSize(new Dimension(me.getCoordManager().getPreferredWidth() , me.getCoordManager().getPreferredHeight())); JMenuBar menu = MenuCreator.getAlignmentPanelMenu(frame,me,afpChain,null); frame.setJMenuBar(menu); JScrollPane scroll = new JScrollPane(me); scroll.setAutoscrolls(true); StatusDisplay status = new StatusDisplay(); status.setAfpChain(afpChain); status.setCa1(ca1); status.setCa2(ca2); me.addAlignmentPositionListener(status); Box vBox = Box.createVerticalBox(); vBox.add(scroll); vBox.add(status); frame.getContentPane().add(vBox); frame.pack(); frame.setVisible(true); // make sure they get cleaned up correctly: frame.addWindowListener(me); frame.addWindowListener(status); }
Example 12
Source File: GameInfoDialog.java From FancyBing with GNU General Public License v3.0 | 5 votes |
private void createTime(TimeSettings timeSettings, JComponent labels, JComponent values) { Box boxLabel = Box.createHorizontalBox(); boxLabel.add(Box.createHorizontalGlue()); JLabel label = new JLabel(i18n("LB_GAMEINFO_TIME")); label.setAlignmentY(Component.CENTER_ALIGNMENT); boxLabel.add(label); labels.add(boxLabel); Box boxValue = Box.createVerticalBox(); JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); boxValue.add(Box.createVerticalGlue()); boxValue.add(panel); boxValue.add(Box.createVerticalGlue()); m_preByoyomi = new TimeField(3, "TT_GAMEINFO_TIME_MAIN"); if (timeSettings != null) m_preByoyomi.setTime(timeSettings.getPreByoyomi()); panel.add(m_preByoyomi); panel.add(new JLabel(" + ")); m_byoyomi = new TimeField(2, "TT_GAMEINFO_TIME_BYOYOMI"); if (timeSettings != null && timeSettings.getUseByoyomi()) m_byoyomi.setTime(timeSettings.getByoyomi()); panel.add(m_byoyomi); panel.add(new JLabel(" / ")); m_byoyomiMoves = new JTextField(2); m_byoyomiMoves.setToolTipText(i18n("TT_GAMEINFO_TIME_BYOYOMI_MOVES")); m_byoyomiMoves.setHorizontalAlignment(JTextField.RIGHT); if (timeSettings != null && timeSettings.getUseByoyomi()) { int byoyomiMoves = timeSettings.getByoyomiMoves(); m_byoyomiMoves.setText(Integer.toString(byoyomiMoves)); } panel.add(m_byoyomiMoves); panel.add(new JLabel(" " + i18n("LB_GAMEINFO_TIME_MOVES"))); values.add(boxValue); }
Example 13
Source File: AnalyzeDialog.java From FancyBing with GNU General Public License v3.0 | 4 votes |
private JComponent createLowerPanel() { Box panel = Box.createVerticalBox(); panel.add(GuiUtil.createFiller()); m_comboBoxHistory = new JComboBox(); panel.add(m_comboBoxHistory); Box lowerPanel = Box.createVerticalBox(); lowerPanel.setBorder(GuiUtil.createEmptyBorder()); panel.add(lowerPanel); Box optionsPanel = Box.createHorizontalBox(); lowerPanel.add(optionsPanel); JPanel leftPanel = new JPanel(); optionsPanel.add(leftPanel); Box leftBox = Box.createVerticalBox(); leftPanel.add(leftBox); m_autoRun = new JCheckBox(i18n("LB_ANALYZE_AUTORUN")); m_autoRun.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (! m_autoRun.isSelected()) m_listener.actionClearAnalyzeCommand(); } }); m_autoRun.setToolTipText(i18n("TT_ANALYZE_AUTORUN")); m_autoRun.setEnabled(false); leftBox.add(m_autoRun); m_clearBoard = new JCheckBox(i18n("LB_ANALYZE_CLEARBOARD")); m_clearBoard.setToolTipText(i18n("TT_ANALYZE_CLEARBOARD")); m_clearBoard.setEnabled(false); leftBox.add(m_clearBoard); m_clearBoard.setSelected(true); m_reuseWindow = new JCheckBox(i18n("LB_ANALYZE_REUSE_TEXT_WINDOW")); m_reuseWindow.setToolTipText(i18n("TT_ANALYZE_REUSE_TEXT_WINDOW")); leftBox.add(m_reuseWindow); JPanel rightPanel = new JPanel(); rightPanel.add(createColorPanel()); optionsPanel.add(rightPanel); // TODO: The following horizontal glue does not really work as expected // (tested on Linux/Sun Java 1.6.0_14) and the left two components in // the box are not aligned to the left. optionsPanel.add(Box.createHorizontalGlue()); // TODO: If GTK Looks L&F is used on Linux/Sun Java 1.6.0_14 or OpenJDK // 6b14-1.4.1-0ubuntu11, then the text of the checkbox items can be // truncated a bit on the left (wrong minimum size calculation?). The // two fillers are a workaround for this. optionsPanel.add(GuiUtil.createFiller()); optionsPanel.add(GuiUtil.createFiller()); lowerPanel.add(createButtons()); m_comboBoxHistory.addActionListener(this); return panel; }
Example 14
Source File: SymmetryGui.java From biojava with GNU Lesser General Public License v2.1 | 4 votes |
private SymmetryGui() { super(); thread = null; JMenuBar menu = MenuCreator.initAlignmentGUIMenu(this); this.setJMenuBar(menu); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setTitle(MAIN_TITLE); tab1 = new SelectPDBPanel(false); tab2 = new PDBUploadPanel(false); tab3 = new ScopSelectPanel(false); //setup tabPane tabPane = new JTabbedPane(); tabPane.addTab("Select PDB ID", null, tab1, "Select PDB ID to analyze"); tabPane.addTab("Domain",null, tab3,"Select domain to analyze."); tabPane.addTab("Custom file",null, tab2,"Analyze your own file."); Box hBoxAlgo = setupAlgorithm(); Box vBox = Box.createVerticalBox(); vBox.add(tabPane); vBox.add(Box.createGlue()); masterPane = new JTabbedPane(); masterPane.addTab("Symmetry Analysis", vBox); Box vBoxMain = Box.createVerticalBox(); vBoxMain.add(hBoxAlgo); vBoxMain.add(masterPane); vBoxMain.add(initButtons()); this.getContentPane().add(vBoxMain); this.pack(); this.setVisible(true); }
Example 15
Source File: GameInfoDialog.java From FancyBing with GNU General Public License v3.0 | 4 votes |
private GameInfoDialog(GameInfo info) { Box outerBox = Box.createVerticalBox(); m_white = createPlayerInfo(WHITE, info); m_white.m_box.setAlignmentX(Component.LEFT_ALIGNMENT); outerBox.add(m_white.m_box); outerBox.add(GuiUtil.createFiller()); m_black = createPlayerInfo(BLACK, info); m_black.m_box.setAlignmentX(Component.LEFT_ALIGNMENT); outerBox.add(m_black.m_box); outerBox.add(GuiUtil.createFiller()); outerBox.add(GuiUtil.createFiller()); Box box = Box.createHorizontalBox(); box.setAlignmentX(Component.LEFT_ALIGNMENT); outerBox.add(box); JPanel labels = new JPanel(new GridLayout(0, 1, 0, GuiUtil.PAD)); box.add(labels); box.add(GuiUtil.createSmallFiller()); JPanel values = new JPanel(new GridLayout(0, 1, 0, GuiUtil.PAD)); box.add(values); m_result = createEntry("LB_GAMEINFO_RESULT", 12, info.get(StringInfo.RESULT), "TT_GAMEINFO_RESULT", labels, values); m_date = createEntry("LB_GAMEINFO_DATE", 12, info.get(StringInfo.DATE), "TT_GAMEINFO_DATE", labels, values); m_rules = createEntry("LB_GAMEINFO_RULES", 12, info.get(StringInfo.RULES), "TT_GAMEINFO_RULES", labels, values); String komi = ""; if (info.getKomi() != null) komi = info.getKomi().toString(); m_komi = createEntry("LB_GAMEINFO_KOMI", 12, komi, "TT_GAMEINFO_KOMI", labels, values); createTime(info.getTimeSettings(), labels, values); setMessage(outerBox); setOptionType(OK_CANCEL_OPTION); }
Example 16
Source File: RawTextDataComp.java From scelight with Apache License 2.0 | 4 votes |
@Override protected void buildGui() { final List< XCheckBox > componentCheckBoxList = Utils.asNewList( showHeaderCheckBox, showDetailsCheckBox, showInitDataCheckBox, showAttributesCheckBox, showMessagesCheckBox, showGameEventsCheckBox, showTrackerEventsCheckBox ); XToolBar toolBar = new XToolBar(); toolBarsBox.add( toolBar ); toolBar.add( new XLabel( "Components to include:" ).verticalBorder( 7 ) ); toolBar.addSeparator(); final Box box = Box.createVerticalBox(); box.setBorder( BorderFactory.createEmptyBorder( 0, 0, 0, 5 ) ); SettingsGui.bindVisibilityToSkillLevel( box, SkillLevel.NORMAL ); final XButton allButton = new XButton( "All", Icons.F_UI_CHECK_BOX.get() ); allButton.setToolTipText( "Select All Components" ); allButton.configureAsIconButton(); box.add( allButton ); final XButton noneButton = new XButton( "None", Icons.F_UI_CHECK_BOX_UNCHECK.get() ); noneButton.setToolTipText( "Deselect All Components" ); noneButton.configureAsIconButton(); box.add( noneButton ); toolBar.add( box ); final ActionListener actionListener = new ActionAdapter() { @Override public void actionPerformed( final ActionEvent event ) { // Only rebuild if there is change int count = 0; final boolean select = event.getSource() == allButton; for ( final XCheckBox userCheckBox : componentCheckBoxList ) if ( userCheckBox.isSelected() != select ) { userCheckBox.setSelected( select ); count++; } if ( count > 0 ) rebuilderListener.actionPerformed( null ); } }; allButton.addActionListener( actionListener ); noneButton.addActionListener( actionListener ); toolBar.addSeparator(); if ( repProc.replay.trackerEvents == null ) showTrackerEventsCheckBox.setVisible( false ); for ( final XCheckBox cb : componentCheckBoxList ) { cb.addActionListener( rebuilderListener ); toolBar.add( cb ); } toolBar.finalizeLayout(); super.buildGui(); // Extend original tool bar toolBar = this.toolBar; // Move the info component (currently the last) to the end final Component infoComp = toolBar.getComponent( toolBar.getComponentCount() - 1 ); toolBar.remove( toolBar.getComponentCount() - 1 ); // Add show line numbers check box showLineNumbersCheckBox.setText( "Line numbers" ); toolBar.add( showLineNumbersCheckBox ); toolBar.addSeparator(); toolBar.add( infoComp ); toolBar.finalizeLayout(); }
Example 17
Source File: KNNDemo.java From COMP3204 with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public Component getComponent(int width, int height) throws IOException { points = new ArrayList<double[]>(); classes = new ArrayList<Integer>(); k = 1; vc = new VideoCaptureComponent(VIDEO_WIDTH, VIDEO_HEIGHT); vc.getDisplay().addVideoListener(this); // the main panel final JPanel base = new JPanel(); base.setOpaque(false); base.setPreferredSize(new Dimension(width, height)); base.setLayout(new GridBagLayout()); // left hand side (video, features) final Box videoCtrls = Box.createVerticalBox(); videoCtrls.add(vc); videoCtrls.add(Box.createVerticalStrut(10)); final JPanel colourspacesPanel = createColourSpaceButtons(); videoCtrls.add(colourspacesPanel); createFeatureField(); videoCtrls.add(Box.createVerticalStrut(10)); videoCtrls.add(featureField); base.add(videoCtrls); // right hand box final Box rightPanel = Box.createVerticalBox(); rightPanel.setOpaque(false); image = new MBFImage(GRAPH_WIDTH, GRAPH_HEIGHT, ColourSpace.RGB); image.fill(RGBColour.WHITE); imageComp = new DisplayUtilities.ImageComponent(true, false); imageComp.setShowPixelColours(false); imageComp.setShowXYPosition(false); imageComp.setAllowZoom(false); imageComp.setAllowPanning(false); rightPanel.add(imageComp); final JPanel classCtrlsCnt = new JPanel(new GridLayout(1, 2)); // learning controls final JPanel learnCtrls = new JPanel(new GridLayout(0, 1)); learnCtrls.setOpaque(false); classType = new JComboBox<String>(); for (final String c : CLASSES) classType.addItem(c); learnCtrls.add(classType); final JButton learnButton = new JButton("Learn"); learnButton.setActionCommand("button.learn"); learnButton.addActionListener(this); learnCtrls.add(learnButton); classCtrlsCnt.add(learnCtrls); // classification controls final JPanel classCtrls = new JPanel(new GridLayout(0, 1)); classCtrls.setOpaque(false); final JPanel cnt = new JPanel(); cnt.add(new JLabel("K:")); final JSpinner kField = new JSpinner(new SpinnerNumberModel(k, 1, 10, 1)); kField.addChangeListener(this); cnt.add(kField); classCtrls.add(cnt); guess = new JTextField(8); guess.setOpaque(false); guess.setFont(Font.decode("Monaco-24")); guess.setHorizontalAlignment(JTextField.CENTER); guess.setEditable(false); classCtrls.add(guess); classCtrlsCnt.add(classCtrls); rightPanel.add(classCtrlsCnt); base.add(rightPanel); redraw(); return base; }
Example 18
Source File: ContextView.java From netbeans with Apache License 2.0 | 4 votes |
/** * * @author Tim Boudreau * @author Marian Petras */ public ContextView(ResultModel resultModel, ExplorerManager explorerManager) { Border b = BorderFactory.createCompoundBorder( BorderFactory.createMatteBorder( //outside border 0, 0, 1, 0, UIManager.getColor("controlShadow")), //NOI18N BorderFactory.createEmptyBorder( //inside border 5, 5, 1, 5)); lblPath.setBorder(b); editorPane.setEditable(false); editorPane.getCaret().setBlinkRate(0); editorScroll = new JScrollPane(editorPane); editorScroll.setViewportBorder(BorderFactory.createEmptyBorder()); editorScroll.setBorder(BorderFactory.createEmptyBorder()); JPanel fileViewPanel = new JPanel(); fileViewPanel.setLayout(new BorderLayout()); fileViewPanel.add(lblPath, BorderLayout.NORTH); fileViewPanel.add(editorScroll, BorderLayout.CENTER); Box messagePanel = Box.createVerticalBox(); messagePanel.add(Box.createVerticalGlue()); messagePanel.add(lblMessage); messagePanel.add(Box.createVerticalGlue()); lblMessage.setAlignmentX(0.5f); lblMessage.setHorizontalAlignment(SwingConstants.CENTER); lblMessage.setEnabled(false); setLayout(cardLayout = new CardLayout()); add(fileViewPanel, FILE_VIEW); add(messagePanel, MESSAGE_VIEW); setResultModel(resultModel); this.explorerManager = explorerManager; explorerManager.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("selectedNodes")) { updateForSelection(); } } }); }
Example 19
Source File: TomatoKNNClassifierDemo.java From COMP3204 with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public Component getComponent(final int width, final int height) throws IOException { points = new ArrayList<double[]>(); classes = new ArrayList<Integer>(); k = 1; circle = new Circle(VIDEO_WIDTH / 2, VIDEO_HEIGHT / 2, VIDEO_HEIGHT / 8); vc = new VideoCaptureComponent(VIDEO_WIDTH, VIDEO_HEIGHT); vc.getDisplay().addVideoListener(this); // the main panel final JPanel base = new JPanel() { private static final long serialVersionUID = 1L; @Override protected void paintComponent(Graphics g) { ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); super.paintComponent(g); if (bgImage != null) g.drawImage(bgImage, 0, 0, width, height, null); } }; base.setOpaque(false); base.setPreferredSize(new Dimension(width, height)); base.setLayout(new GridBagLayout()); // left hand side (video, features) final Box videoCtrls = Box.createVerticalBox(); videoCtrls.add(vc); videoCtrls.add(Box.createVerticalStrut(10)); final JPanel colourspacesPanel = createColourSpaceButtons(); videoCtrls.add(colourspacesPanel); createFeatureField(); videoCtrls.add(Box.createVerticalStrut(10)); videoCtrls.add(featureField); base.add(videoCtrls); // right hand box final Box rightPanel = Box.createVerticalBox(); rightPanel.setOpaque(false); guess = new JTextField(8); guess.setOpaque(false); guess.setFont(Font.decode("Monaco-48")); guess.setHorizontalAlignment(JTextField.CENTER); guess.setEditable(false); rightPanel.add(guess); image = new MBFImage(GRAPH_WIDTH, GRAPH_HEIGHT, ColourSpace.RGB); image.fill(RGBColour.WHITE); imageComp = new DisplayUtilities.ImageComponent(true, false); imageComp.setShowPixelColours(false); imageComp.setShowXYPosition(false); imageComp.setAllowZoom(false); imageComp.setAllowPanning(false); rightPanel.add(imageComp); final JPanel classCtrlsCnt = new JPanel(new GridLayout(1, 2)); classCtrlsCnt.setOpaque(false); // learning controls final JPanel learnCtrls = new JPanel(new GridLayout(0, 1)); learnCtrls.setOpaque(false); classType = new JComboBox<String>(); for (final String c : CLASSES) classType.addItem(c); learnCtrls.add(classType); final JButton learnButton = new JButton("Learn"); learnButton.setActionCommand("button.learn"); learnButton.addActionListener(this); learnCtrls.add(learnButton); classCtrlsCnt.add(learnCtrls); // classification controls final JPanel classCtrls = new JPanel(new GridLayout(0, 1)); classCtrls.setOpaque(false); final JPanel cnt = new JPanel(); cnt.setOpaque(false); cnt.add(new JLabel("K:")); final JSpinner kField = new JSpinner(new SpinnerNumberModel(k, 1, 10, 1)); kField.addChangeListener(this); cnt.add(kField); classCtrls.add(cnt); classCtrlsCnt.add(classCtrls); rightPanel.add(classCtrlsCnt); base.add(rightPanel); redraw(); return base; }
Example 20
Source File: CollectionSelectionDialog.java From gate-core with GNU Lesser General Public License v3.0 | 4 votes |
/** This method creates the GUI components and paces them into the layout*/ protected void initGuiComponents(){ this.getContentPane().setLayout(new BoxLayout(this.getContentPane(), BoxLayout.Y_AXIS)); // Create source label sourceLabel = new JLabel("Source"); sourceLabel.setAlignmentX(Component.LEFT_ALIGNMENT); // Create source list sourceList = new JList(sourceListModel); sourceList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); sourceList.setVisibleRowCount(10); sourceList.setAlignmentX(Component.LEFT_ALIGNMENT); // Create target label targetLabel = new JLabel("Target"); targetLabel.setAlignmentX(Component.LEFT_ALIGNMENT); // Create the target list targetList = new JList(targetListModel); targetList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); targetList.setVisibleRowCount(10); targetList.setAlignmentX(Component.LEFT_ALIGNMENT); targetList.setPreferredSize(sourceList.getPreferredSize()); // Create Add >> button addButton = new JButton(">>>"); // Create Remove << button removeButton = new JButton("<<<"); // Create ok button okButton = new JButton("Ok"); // Create cancel button cancelButton = new JButton("Cancel"); /////////////////////////////////////// // Arange components ////////////////////////////////////// // Create the main box Box componentsBox = Box.createVerticalBox(); componentsBox.add(Box.createRigidArea(new Dimension(0,5))); Box firstLevelBox = Box.createHorizontalBox(); firstLevelBox.add(Box.createRigidArea(new Dimension(10,0))); // Add the Source list Box currentBox = Box.createVerticalBox(); currentBox.add(sourceLabel); currentBox.add(new JScrollPane(sourceList)); // Add the current box to the firstLevelBox firstLevelBox.add(currentBox); firstLevelBox.add(Box.createRigidArea(new Dimension(10,0))); // Add the add and remove buttons currentBox = Box.createVerticalBox(); currentBox.add(addButton); currentBox.add(Box.createRigidArea(new Dimension(0,10))); currentBox.add(removeButton); // Add the remove buttons to the firstLevelBox firstLevelBox.add(currentBox); firstLevelBox.add(Box.createRigidArea(new Dimension(10,0))); // Add the target list currentBox = Box.createVerticalBox(); currentBox.add(targetLabel); currentBox.add(new JScrollPane(targetList)); // Add target list to the firstLevelBox firstLevelBox.add(currentBox); firstLevelBox.add(Box.createRigidArea(new Dimension(20,0))); // Add ok and cancel buttons to the currentBox currentBox = Box.createHorizontalBox(); currentBox.add(Box.createHorizontalGlue()); currentBox.add(okButton); currentBox.add(Box.createRigidArea(new Dimension(25,0))); currentBox.add(cancelButton); currentBox.add(Box.createHorizontalGlue()); // Add all components to the components box componentsBox.add(firstLevelBox); componentsBox.add(Box.createRigidArea(new Dimension(0,10))); componentsBox.add(currentBox); componentsBox.add(Box.createRigidArea(new Dimension(0,5))); // Add the components box to the dialog this.getContentPane().add(componentsBox); this.pack(); }