List of usage examples for javax.swing BoxLayout Y_AXIS
int Y_AXIS
To view the source code for javax.swing BoxLayout Y_AXIS.
Click Source Link
From source file:org.jcurl.demo.smack.ChatSimpleSwingBean.java
public ChatSimpleSwingBean() { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); text = new JTextField(); // see/* w w w . jav a 2 s . co m*/ // http://java.sun.com/products/jfc/tsc/tech_topics/jlist_1/jlist.html: final KeyListener keyListener = new KeyAdapter() { @Override public void keyTyped(KeyEvent evt) { if ('\n' == evt.getKeyChar()) try { send(text.getText()); text.setText(""); } catch (XMPPException e) { log.error("Sending \"" + text.getText() + "\"", e); } } }; text.addKeyListener(keyListener); add(text); setEnabled(false); }
From source file:org.jcurl.demo.tactics.BroomPromptSwingBean.java
public BroomPromptSwingBean() { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); final Box b = Box.createVerticalBox(); {//from w w w . java 2 s .c om 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(); {//from w w w . j a v a 2s. c o 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.kepler.gui.ComponentLibraryPreferencesTab.java
public void initializeTab() throws Exception { _repositoryManager = RepositoryManager.getInstance(); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); initDoc();//w w w . j a v a 2 s . c om initTopPanel(); initSourceList(); this.setMinimumSize(new Dimension(300, 300)); this.setPreferredSize(new Dimension(300, 300)); this.setBackground(TabManager.BGCOLOR); }
From source file:org.kepler.gui.KeplerGraphFrame.java
/** * Override BasicGraphFrame._initBasicGraphFrame() */// w w w . j a va 2 s . com @Override protected void _initBasicGraphFrame() { /** * @todo - FIXME - Need to move this further up the hierarchy, so other * types of frames use it too. Don't put it in a launcher class * like KeplerApplication, because it then gets overridden later, * elsewhere in PTII */ StaticGUIResources.setLookAndFeel(); _initBasicGraphFrameInitialization(); _dropTarget = BasicGraphFrameExtension.getDropTarget(_jgraph); // add a CanvasDropTargetListener so that other classes can get CanvasDropTargetListener listener = CanvasDropTargetListener.getInstance(); _dropTarget.registerAdditionalListener(listener); ActionListener deletionListener = new DeletionListener(); _rightComponent.registerKeyboardAction(deletionListener, "Delete", KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); _rightComponent.registerKeyboardAction(deletionListener, "BackSpace", KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); _initBasicGraphFrameRightComponent(); _jgraph.setRequestFocusEnabled(true); // Background color is parameterizable by preferences. Configuration configuration = getConfiguration(); if (configuration != null) { try { // Set the PtolemyPreference to the desired background. // See // http://bugzilla.ecoinformatics.org/show_bug.cgi?id=2321#c14 PtolemyPreferences preferences = PtolemyPreferences .getPtolemyPreferencesWithinConfiguration(configuration); if (_isDebugging) { _log.debug("bg: " + BACKGROUND_COLOR); } if (preferences != null) { float[] components = new float[4]; // Make sure we get only 4 elements in case the color space // is bigger than 4 components = BACKGROUND_COLOR.getComponents(components); preferences.backgroundColor.setExpression("{" + components[0] + "," + components[1] + "," + components[2] + "," + components[3] + "}"); _rightComponent.setBackground(preferences.backgroundColor.asColor()); if (_isDebugging) { _log.debug("desired background: " + BACKGROUND_COLOR + " actual background: " + preferences.backgroundColor.asColor()); } } } catch (IllegalActionException e1) { // Ignore the exception and use the default color. } } _initBasicGraphFrameRightComponentMouseListeners(); try { // The SizeAttribute property is used to specify the size // of the JGraph component. Unfortunately, with Swing's // mysterious and undocumented handling of component sizes, // there appears to be no way to control the size of the // JGraph from the size of the Frame, which is specified // by the WindowPropertiesAttribute. SizeAttribute size = (SizeAttribute) getModel().getAttribute("_vergilSize", SizeAttribute.class); if (size != null) { size.setSize(_jgraph); } else { // Set the default size. // Note that the location is of the frame, while the size // is of the scrollpane. _jgraph.setPreferredSize(new Dimension(600, 400)); } _initBasicGraphFrameSetZoomAndPan(); } catch (Exception ex) { // Ignore problems here. Errors simply result in a default // size and location. } // Create the panner. _graphPanner = new JCanvasPanner(_jgraph); _horizontalScrollBar = new JScrollBar(Adjustable.HORIZONTAL); _verticalScrollBar = new JScrollBar(Adjustable.VERTICAL); // see if we want scrollbars on the canvas or not // the answer defaults to 'no' CanvasNavigationModifierFactory CNMfactory = (CanvasNavigationModifierFactory) getConfiguration() .getAttribute("canvasNavigationModifier"); if (CNMfactory != null) { // get the scrollbar flag from the factory if // it exists in the config ScrollBarModifier modifier = CNMfactory.createScrollBarModifier(); _scrollBarFlag = modifier.getScrollBarModifier(); } _canvasPanel = new JPanel(); _canvasPanel.setBorder(null); _canvasPanel.setLayout(new BorderLayout()); if (_scrollBarFlag) { _canvasPanel.add(_horizontalScrollBar, BorderLayout.SOUTH); _canvasPanel.add(_verticalScrollBar, BorderLayout.EAST); _horizontalScrollBar.setModel(_jgraph.getGraphPane().getCanvas().getHorizontalRangeModel()); _verticalScrollBar.setModel(_jgraph.getGraphPane().getCanvas().getVerticalRangeModel()); _horizontalScrollBarListener = new ScrollBarListener(_horizontalScrollBar); _verticalScrollBarListener = new ScrollBarListener(_verticalScrollBar); _horizontalScrollBar.addAdjustmentListener(_horizontalScrollBarListener); _verticalScrollBar.addAdjustmentListener(_verticalScrollBarListener); } // NOTE: add _rightComponent instead of _jgraph since _rightComponent // may be sub-divided into tabbed panes. // see http://bugzilla.ecoinformatics.org/show_bug.cgi?id=3708 _canvasPanel.add(_rightComponent, BorderLayout.CENTER); TabManager tabman = TabManager.getInstance(); tabman.initializeTabs(this); ViewManager viewman = ViewManager.getInstance(); viewman.initializeViews(this); try { viewman.addCanvasToLocation(_canvasPanel, this); } catch (Exception e) { throw new RuntimeException("Could not add canvas panel: " + e.getMessage()); } // _jgraph.setMinimumSize(new Dimension(0, 0)); getContentPane().add(viewman.getViewArea(this), BorderLayout.CENTER); // The toolbar panel is the container that contains the main toolbar and // any additional toolbars JPanel toolbarPanel = new JPanel(); toolbarPanel.setLayout(new BoxLayout(toolbarPanel, BoxLayout.Y_AXIS)); // They // stack _toolbar = new JToolBar(); // The main Kepler toolbar toolbarPanel.add(_toolbar); getContentPane().add(toolbarPanel, BorderLayout.NORTH); // Place the // toolbar panel _initBasicGraphFrameToolBarZoomButtons(); _initBasicGraphFrameActions(); // Add a weak reference to this to keep track of all // the graph frames that have been created. _openGraphFrames.add(this); System.gc(); }
From source file:org.kuali.student.repository.viewer.GitGraphDetailsPanel.java
/** * @param branchHeadCommitToBranchNameMap * @param simplify /*from ww w .j a va2 s. c o m*/ * @param jComboBox * */ public GitGraphDetailsPanel(JComboBox modeComboBox, Map<RevCommit, String> branchHeadCommitToBranchNameMap, boolean simplify) { super(); this.branchHeadCommitToBranchNameMap = branchHeadCommitToBranchNameMap; this.simplify = simplify; setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); addSubPanel(new JLabel("Mouse Click Mode: "), modeComboBox); addSubPanel(new JLabel("In Edges: "), inEdgesLabel = new JLabel("")); addSubPanel(new JLabel("Object id: "), objectIdLabel = new JLabel("")); addSubPanel(new JLabel("Parent ids: "), parentIdsLabel = new JLabel("")); addSubPanel(new JLabel("Message: "), commitMessage = new JTextArea("")); commitMessage.setEditable(false); addSubPanel(new JLabel("Committer: "), committer = new JLabel("")); addSubPanel(new JLabel("Commit Date: "), commitDate = new JLabel("")); branchNamePanel = addSubPanel(new JLabel("Branch Name: "), branchNameLabel = new JLabel("")); // modeComboBox.addActionListener(new ActionListener() { // // @Override // public void actionPerformed(ActionEvent e) { // // } // }); }
From source file:org.nebulaframework.ui.swing.AboutDialog.java
/** * No-args Constructor constructs and displays * the about dialog as a modal dialog of the * specified owner frame./*from w w w . j a v a 2 s. co m*/ * * @param owner Owner frame */ public AboutDialog(Frame owner) { super(owner, true); setTitle("About Nebula Framework " + Grid.VERSION); this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); this.setSize(320, 500); this.setLayout(new BorderLayout()); this.setLocationRelativeTo(this); // Center on Main UI /* -- Logo Image Section -- */ JLabel lbl = new JLabel( new ImageIcon(ClassLoader.getSystemResource("META-INF/resources/nebula-about.png"))); this.add(lbl, BorderLayout.CENTER); JPanel southPanel = new JPanel(); southPanel.setLayout(new BoxLayout(southPanel, BoxLayout.Y_AXIS)); this.add(southPanel, BorderLayout.SOUTH); /* -- Information Section -- */ JPanel information = new JPanel(); information.setBorder(BorderFactory.createTitledBorder("Information")); information.setLayout(new BorderLayout()); JPanel westPanel = new JPanel(); westPanel.setLayout(new BoxLayout(westPanel, BoxLayout.Y_AXIS)); information.add(westPanel, BorderLayout.WEST); JPanel centerPanel = new JPanel(); centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.Y_AXIS)); information.add(centerPanel, BorderLayout.CENTER); westPanel.add(new JLabel("Version : ")); centerPanel.add(new JLabel(Grid.VERSION)); westPanel.add(new JLabel("Project Site : ")); final String site_link = "http://code.google.com/p/nebulaframework"; JLabel siteLabel = new JLabel( "<html><body><a href=\"" + site_link + "\">" + site_link + "</a></body></html>"); centerPanel.add(siteLabel); siteLabel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent evt) { try { Browser.displayURL(site_link); } catch (IOException e) { log.warn("[UI] Unable to invoke Browser", e); } } }); westPanel.add(new JLabel("Project Blog : ")); final String blog_link = "http://nebulaframework.blogspot.com"; JLabel blogLabel = new JLabel( "<html><body><a href=\"" + blog_link + "\">" + blog_link + "</a></body></html>"); centerPanel.add(blogLabel); blogLabel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent evt) { try { Browser.displayURL(blog_link); } catch (IOException e) { log.warn("[UI] Unable to invoke Browser", e); } } }); westPanel.add(new JLabel("License : ")); centerPanel.add(new JLabel("Apache 2.0 License")); southPanel.add(information); /* -- Copyright Section -- */ JPanel developedBy = new JPanel(); developedBy.setBorder(BorderFactory.createTitledBorder("Developer / Copyright")); developedBy.setLayout(new BorderLayout()); developedBy.add(new JLabel("Copyright (C) 2008 Yohan Liyanage", JLabel.CENTER), BorderLayout.CENTER); southPanel.add(developedBy); // Resize to fit to size this.pack(); this.setResizable(false); // Initialize Browser Browser.init(); // Show this.setVisible(true); }
From source file:org.ngrinder.recorder.ui.AboutDialog.java
/** * Initialize UI./*w w w. ja va 2 s. co m*/ */ protected void initUI() { JPanel jContentPane = new JPanel(); jContentPane.setBorder(new EmptyBorder(10, 10, 10, 10)); jContentPane.setLayout(new BoxLayout(jContentPane, BoxLayout.Y_AXIS)); jContentPane.add(getIcon()); jContentPane.add(Box.createVerticalStrut(16)); jContentPane.add(getAppName()); jContentPane.add(Box.createVerticalStrut(8)); jContentPane.add(getVersion()); jContentPane.add(Box.createVerticalStrut(8)); jContentPane.add(getCompany()); jContentPane.add(getRights()); jContentPane.add(Box.createVerticalStrut(8)); jContentPane.add(getLicenseTextArea()); setContentPane(jContentPane); }
From source file:org.ngrinder.recorder.ui.RecordingControlPanel.java
/** * Create filter by type panel.// w ww. jav a 2s. c o m * * @return created panel */ protected JPanel createTypeFilterPanel() { JPanel panel = new JPanel(); panel.setBorder(new TitledBorder("Recorded Type")); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); for (FileTypeCategory each : FileTypeCategory.values()) { panel.add(new JExtendedCheckBox(each.name(), each.getDisplayName(), true)); } return panel; }
From source file:org.o3project.optsdn.don.frame.NeFrame.java
/** * Create a NE frame panel./*w ww .ja v a 2 s . c o m*/ * * @return The NE frame panel */ private JPanel createNePanel() { JPanel nePanel = new JPanel(); nePanel.setBackground(Color.WHITE); nePanel.setLayout(new BorderLayout()); JPanel centerPanel = new JPanel(); centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.Y_AXIS)); centerPanel.add(createDrawingNePane()); centerPanel.add(createOmsConnectionInfoPane()); centerPanel.add(createInformationModelIdListPane(portList)); nePanel.add(centerPanel, BorderLayout.CENTER); nePanel.add(createConnectButtonPanel(), BorderLayout.SOUTH); return nePanel; }