List of usage examples for javax.swing BoxLayout BoxLayout
@ConstructorProperties({ "target", "axis" }) public BoxLayout(Container target, int axis)
From source file:com.archivas.clienttools.arcmover.gui.panels.ProfilePanel.java
private void initGuiComponents() { fileListModel = new FileListTableModel(); fileList = new FileListTable(fileListModel); fileList.addKeyListener(new KeyAdapter() { @Override//from w w w. ja va 2 s . co m public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { openSelectedFile(); e.consume(); } } }); fileList.setAutoCreateColumnsFromModel(true); fileList.setDropMode(DropMode.ON_OR_INSERT_ROWS); fileList.setFillsViewportHeight(true); fileList.setGridColor(new Color(-1)); fileListScrollPane = new JScrollPane(fileList); fileListScrollPane.setAutoscrolls(false); fileListScrollPane.setBackground(UIManager.getColor("TableHeader.background")); fileListScrollPane.setPreferredSize(new Dimension(100, 128)); fileListScrollPane.setEnabled(false); // // toolbar // final JToolBar toolBar1 = new JToolBar(); toolBar1.setBorderPainted(false); toolBar1.setFloatable(false); toolBar1.setRollover(true); toolBar1.putClientProperty("JToolBar.isRollover", Boolean.TRUE); homeDirectoryButton = new JButton(); homeDirectoryButton.setHorizontalAlignment(2); homeDirectoryButton.setIcon(GUIHelper.HOME_ICON); homeDirectoryButton.setMargin(new Insets(3, 3, 3, 3)); homeDirectoryButton.setText(""); homeDirectoryButton.setToolTipText("Go to home directory"); homeDirectoryButton.setEnabled(false); toolBar1.add(homeDirectoryButton); refreshButton = new JButton(); refreshButton.setHorizontalAlignment(2); refreshButton.setIcon(new ImageIcon(getClass().getResource("/images/refresh.gif"))); refreshButton.setMargin(new Insets(3, 3, 3, 3)); refreshButton.setText(""); refreshButton.setToolTipText("Refresh current directory listing"); refreshButton.setEnabled(false); toolBar1.add(refreshButton); upDirectoryButton = new JButton(); upDirectoryButton.setHideActionText(false); upDirectoryButton.setHorizontalAlignment(2); upDirectoryButton.setIcon(GUIHelper.UP_DIR_ICON); upDirectoryButton.setMargin(new Insets(3, 3, 3, 3)); upDirectoryButton.setToolTipText("Up"); upDirectoryButton.setEnabled(false); toolBar1.add(upDirectoryButton); browseDirectoryButton = new JButton(); browseDirectoryButton.setHideActionText(false); browseDirectoryButton.setHorizontalAlignment(2); browseDirectoryButton.setIcon(GUIHelper.DIRECTORY_ICON); browseDirectoryButton.setMargin(new Insets(3, 3, 3, 3)); browseDirectoryButton.setToolTipText(BROWSE_LFS_TEXT); browseDirectoryButton.setEnabled(false); toolBar1.add(browseDirectoryButton); profileModel = new ProfileComboBoxModel(); profileSelectionCombo = new JComboBox(profileModel); profileSelectionCombo.setEnabled(false); profileSelectionCombo.setToolTipText("Select a namespace profile"); profileSelectionCombo.setPrototypeDisplayValue("#"); pathCombo = new JComboBox(); pathCombo.setEditable(false); pathCombo.setEnabled(false); pathCombo.setToolTipText("Current directory path"); pathCombo.setPrototypeDisplayValue("#"); sslButton = new JButton(); sslButton.setAlignmentY(0.0f); sslButton.setBorderPainted(false); sslButton.setHorizontalAlignment(2); sslButton.setHorizontalTextPosition(11); sslButton.setIcon(new ImageIcon(getClass().getResource("/images/lockedstate.gif"))); sslButton.setMargin(new Insets(0, 0, 0, 0)); sslButton.setMaximumSize(new Dimension(20, 20)); sslButton.setMinimumSize(new Dimension(20, 20)); sslButton.setPreferredSize(new Dimension(20, 20)); sslButton.setText(""); sslButton.setToolTipText("View certificate"); sslButton.setEnabled(false); // // profile and toolbar buttons // JPanel profileAndToolbarPanel = new FixedHeightPanel(); profileAndToolbarPanel.setLayout(new BoxLayout(profileAndToolbarPanel, BoxLayout.X_AXIS)); profileAndToolbarPanel.add(profileSelectionCombo); profileAndToolbarPanel.add(Box.createHorizontalStrut(25)); profileAndToolbarPanel.add(toolBar1); // // Path & SSLCert button // JPanel pathPanel = new FixedHeightPanel(); pathPanel.setLayout(new BoxLayout(pathPanel, BoxLayout.X_AXIS)); pathCombo.setAlignmentY(CENTER_ALIGNMENT); pathPanel.add(pathCombo); pathPanel.add(Box.createHorizontalStrut(5)); sslButton.setAlignmentY(CENTER_ALIGNMENT); pathPanel.add(sslButton); // // Put it all together // setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); add(profileAndToolbarPanel); add(Box.createVerticalStrut(5)); add(pathPanel); add(Box.createVerticalStrut(5)); add(fileListScrollPane); setBorder(new EmptyBorder(12, 12, 12, 12)); }
From source file:InterleavedNIOBuffer.java
public void init() { // create textures if (texImage1 == null) { // the path to the image for an applet try {/*from ww w. j a v a 2 s . c o m*/ texImage1 = new java.net.URL(getCodeBase().toString() + "/bg.jpg"); } catch (java.net.MalformedURLException ex) { System.out.println(ex.getMessage()); System.exit(1); } } if (texImage2 == null) { // the path to the image for an applet try { texImage2 = new java.net.URL(getCodeBase().toString() + "/one.jpg"); } catch (java.net.MalformedURLException ex) { System.out.println(ex.getMessage()); System.exit(1); } } Container contentPane = getContentPane(); Canvas3D c = new Canvas3D(SimpleUniverse.getPreferredConfiguration()); contentPane.add("Center", c); BranchGroup scene = createSceneGraph(); // SimpleUniverse is a Convenience Utility class u = new SimpleUniverse(c); // add mouse behaviors to the viewingPlatform ViewingPlatform viewingPlatform = u.getViewingPlatform(); // This will move the ViewPlatform back a bit so the // objects in the scene can be viewed. viewingPlatform.setNominalViewingTransform(); // add Orbit behavior to the viewing platform OrbitBehavior orbit = new OrbitBehavior(c, OrbitBehavior.REVERSE_ALL); BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0); orbit.setSchedulingBounds(bounds); viewingPlatform.setViewPlatformBehavior(orbit); u.addBranchGraph(scene); // Create GUI JPanel p = new JPanel(); BoxLayout boxlayout = new BoxLayout(p, BoxLayout.Y_AXIS); p.add(createGeometryByReferencePanel()); p.setLayout(boxlayout); contentPane.add("South", p); }
From source file:com.unionpay.upmp.jmeterplugin.gui.UPMPUrlConfigGui.java
private void init() {// called from ctor, so must not be overridable this.setLayout(new BorderLayout()); // WEB REQUEST PANEL JPanel webRequestPanel = new JPanel(); webRequestPanel.setLayout(new BorderLayout()); webRequestPanel.setBorder(/*from www. j av a2 s. co m*/ BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), UPMPConstant.upmp_request)); // $NON-NLS-1$ JPanel northPanel = new JPanel(); northPanel.setLayout(new BoxLayout(northPanel, BoxLayout.Y_AXIS)); northPanel.add(getProtocolAndMethodPanel()); northPanel.add(getPathPanel()); webRequestPanel.add(northPanel, BorderLayout.NORTH); webRequestPanel.add(getParameterPanel(), BorderLayout.CENTER); this.add(getWebServerTimeoutPanel(), BorderLayout.NORTH); this.add(webRequestPanel, BorderLayout.CENTER); this.add(getProxyServerPanel(), BorderLayout.SOUTH); }
From source file:eu.apenet.dpt.standalone.gui.APETabbedPane.java
private JComponent makeResultsPanel() { JPanel resultsView = new JPanel(); resultsView.setLayout(new BoxLayout(resultsView, BoxLayout.PAGE_AXIS)); dataPreparationToolGUI.getResultArea().setForeground(new Color(255, 100, 100)); resultsView.add(dataPreparationToolGUI.getResultArea()); return resultsView; }
From source file:es.urjc.ia.fia.genericSearch.statistics.JUNGStatistics.java
@Override public void showStatistics() { // Layout: tree and radial treeLayout = new TreeLayout<AuxVertex, ACTION>(this.tree, 35, 100); radialLayout = new RadialTreeLayout<AuxVertex, ACTION>(this.tree, 35, 130); radialLayout.setSize(new Dimension(200 * (this.tree.getHeight() + 1), 200 * (this.tree.getHeight() + 1))); // The BasicVisualizationServer<V,E> is parameterized by the edge types vv = new VisualizationViewer<AuxVertex, ACTION>(treeLayout); vv.setPreferredSize(new Dimension(800, 600)); //Sets the viewing area size vv.setBackground(Color.white); // Background color vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<AuxVertex>()); vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line<AuxVertex, ACTION>()); // Setup up a new vertex to paint transformer Transformer<AuxVertex, Paint> vertexPaint = new Transformer<AuxVertex, Paint>() { @Override// ww w . ja v a 2s . co m public Paint transform(AuxVertex arg0) { if (arg0.getState().isSolution() && arg0.isExplored()) { return Color.GREEN; } else if (arg0.isExplored()) { return Color.CYAN; } else if (arg0.isDuplicated()) { return Color.GRAY; } else { return Color.WHITE; } } }; // Tooltip for vertex Transformer<AuxVertex, String> toolTipsState = new Transformer<AuxVertex, String>() { @Override public String transform(AuxVertex arg0) { String sortInfo = ""; if (arg0.isExplored()) { if (arg0.getState().isSolution() && arg0.isExplored()) { sortInfo = "<u><i>Solution state " + arg0.getExplored() + "</i></u>"; } else { sortInfo = "<u><i>Explored state " + arg0.getExplored() + "</i></u>"; } } else if (arg0.isDuplicated()) { sortInfo = "<u><i>Duplicated state </i></u>"; } else { sortInfo = "<u><i>Unexplored state</i></u>"; } return "<html><p>" + sortInfo + "</p>" + "<p>State: " + arg0.getState().toString() + "</p>" + "<p>Cost: " + arg0.getState().getSolutionCost() + "</p></html>"; } }; vv.setVertexToolTipTransformer(toolTipsState); // Tooltip for edge Transformer<ACTION, String> toolTipsAction = new Transformer<ACTION, String>() { @Override public String transform(ACTION arg0) { return "Cost: " + arg0.cost(); } }; vv.setEdgeToolTipTransformer(toolTipsAction); vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line<AuxVertex, ACTION>()); vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller<ACTION>()); vv.getRenderContext().setVertexFillPaintTransformer(vertexPaint); vv.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR); // Create a graph mouse and add it to the visualization component DefaultModalGraphMouse<State<ACTION>, ACTION> gm = new DefaultModalGraphMouse<State<ACTION>, ACTION>(); gm.setMode(ModalGraphMouse.Mode.TRANSFORMING); vv.setGraphMouse(gm); vv.addKeyListener(gm.getModeKeyListener()); JFrame vFrame = new JFrame("Statistics Tree View"); vFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); /* vFrame.getContentPane().add(vv); vFrame.pack(); vFrame.setVisible(true); */ rings = new Rings(); Container content = vFrame.getContentPane(); final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv); content.add(panel); JComboBox modeBox = gm.getModeComboBox(); modeBox.addItemListener(gm.getModeListener()); gm.setMode(ModalGraphMouse.Mode.TRANSFORMING); 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() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1 / 1.1f, vv.getCenter()); } }); JToggleButton radial = new JToggleButton("Radial"); radial.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { LayoutTransition<AuxVertex, ACTION> lt = new LayoutTransition<AuxVertex, ACTION>(vv, treeLayout, radialLayout); Animator animator = new Animator(lt); animator.start(); vv.getRenderContext().getMultiLayerTransformer().setToIdentity(); vv.addPreRenderPaintable(rings); } else { LayoutTransition<AuxVertex, ACTION> lt = new LayoutTransition<AuxVertex, ACTION>(vv, radialLayout, treeLayout); Animator animator = new Animator(lt); animator.start(); vv.getRenderContext().getMultiLayerTransformer().setToIdentity(); vv.removePreRenderPaintable(rings); } vv.repaint(); } }); JPanel scaleGrid = new JPanel(new GridLayout(1, 0)); scaleGrid.setBorder(BorderFactory.createTitledBorder("Zoom")); /* * Statistics */ JLabel stats = new JLabel(); long totalTime = endTime.getTime() - initTime.getTime(); stats.setText("<html>" + "<b>Total States:</b> " + this.totalStates + "<br>" + "<b>Explored States:</b> " + this.explorerStates + "<br>" + "<b>Duplicated States (detected):</b> " + this.duplicatedStates + "<br>" + "<b>Solution States:</b> " + this.solutionStates + "<br>" + "<b>Total time: </b>" + totalTime + " milliseconds" + "</html>"); JPanel legend = new JPanel(); legend.setLayout(new BoxLayout(legend, BoxLayout.Y_AXIS)); JLabel len = new JLabel("<html><b>Lengend</b></html>"); JLabel lexpl = new JLabel("Explored state"); lexpl.setBackground(Color.CYAN); lexpl.setOpaque(true); JLabel lune = new JLabel("Unexplored state"); lune.setBackground(Color.WHITE); lune.setOpaque(true); JLabel ldupl = new JLabel("Duplicated state"); ldupl.setBackground(Color.GRAY); ldupl.setOpaque(true); JLabel lsol = new JLabel("Solution state"); lsol.setBackground(Color.GREEN); lsol.setOpaque(true); legend.add(len); legend.add(lexpl); legend.add(lune); legend.add(ldupl); legend.add(lsol); JPanel controls = new JPanel(); controls.add(stats); scaleGrid.add(plus); scaleGrid.add(minus); controls.add(radial); controls.add(scaleGrid); //controls.add(modeBox); controls.add(legend); content.add(controls, BorderLayout.SOUTH); vFrame.pack(); vFrame.setVisible(true); }
From source file:edu.ucla.stat.SOCR.analyses.gui.ConfidenceIntervalAnalysis.java
protected void doGraph() { graphPanel.removeAll();//from w w w. ja v a2 s .c o m JPanel innerPanel = new JPanel(); JScrollPane graphPane = new JScrollPane(innerPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); graphPanel.add(graphPane); innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.Y_AXIS)); graphPanel.setLayout(new BoxLayout(graphPanel, BoxLayout.Y_AXIS)); confidenceCanvas = new ConfidenceCanvasGeneralUpper(sampleSizes, nTrials); confidenceCanvas.setBackground(Color.white); innerPanel.setPreferredSize(new Dimension(650, 400)); confidenceCanvas.setIntervalType(ci_choice); innerPanel.add(confidenceCanvas); confidenceCanvas.update(cvIndex, ciData, sampleData, xBar); /* String[][] ci_storage= new String[xyLength][nTrials]; for (int i=0; i<nTrials; i++) for(int j=0; j<sampleSizes[i]; j++) ci_storage[j][i] = sampleData[i][j]+""; JFreeChart bwChart = chartFactory.getBoxAndWhiskerChart("Box and Whisker Plot", independentHeader, "yHeader", nTrials, 1, xyLength, ci_storage); ChartPanel chartPanel = new ChartPanel(bwChart, false); chartPanel.setPreferredSize(new Dimension(plotWidth,plotHeight)); innerPanel.add(chartPanel); */ graphPanel.validate(); }
From source file:cloud.gui.CloudGUI.java
private JPanel createAddInstancePanel() { JPanel addInstancePanel = new JPanel(); addInstancePanel.setBorder(BorderFactory.createTitledBorder("Launch Instance")); addInstancePanel.setLayout(new BoxLayout(addInstancePanel, BoxLayout.Y_AXIS)); //--------------------------// JPanel labelPanel = new JPanel(); labelPanel.setBorder(BorderFactory.createEmptyBorder()); labelPanel.setLayout(new BorderLayout()); JLabel addANewInstancelbl = new JLabel("Add a new instance with the following configuration:"); labelPanel.add(addANewInstancelbl);//from w w w .ja v a2s .co m addInstancePanel.add(labelPanel); //--------------------------// JPanel nodeConfigurationsPanel = new JPanel(); nodeConfigurationsPanel.setLayout(new GridLayout(4, 2)); nodeConfigurationsPanel.setBorder(BorderFactory.createEmptyBorder()); JLabel cpuSpeedlbl = new JLabel("CPU Speed (GHz)"); nodeConfigurationsPanel.add(cpuSpeedlbl); cpuSpeed = new JComboBox(CPU_SPEEDS); cpuSpeed.setSelectedItem("2.0"); nodeConfigurationsPanel.add(cpuSpeed); JLabel bandwidthlbl = new JLabel("Bandwidth (MB/s):"); nodeConfigurationsPanel.add(bandwidthlbl); bandwidthes = new JComboBox(BANDWIDTHES); bandwidthes.setSelectedItem("2"); nodeConfigurationsPanel.add(bandwidthes); JLabel memoryLbl = new JLabel("Memory (GB)"); nodeConfigurationsPanel.add(memoryLbl); memories = new JComboBox(MEMORIES); memories.setSelectedIndex(2); nodeConfigurationsPanel.add(memories); JLabel simultaneousDownloadsLbl = new JLabel("Simulatenous Downloads:"); nodeConfigurationsPanel.add(simultaneousDownloadsLbl); sDownloads = new JTextArea("70"); nodeConfigurationsPanel.add(sDownloads); addInstancePanel.add(nodeConfigurationsPanel); //--------------------------// JPanel addInstanceButtonPanel = new JPanel(); addInstanceButtonPanel.setBorder(BorderFactory.createEmptyBorder()); addInstanceButtonPanel.setLayout(new GridLayout(2, 2)); addInstanceButton = new JButton("Launch Instance"); addInstanceButtonPanel.add(addInstanceButton); addInstancePanel.add(addInstanceButtonPanel); return addInstancePanel; }
From source file:coreferenceresolver.gui.MarkupGUI.java
private JScrollPane newReviewPanel(Review review, int reviewId) throws BadLocationException { //Model/* ww w . ja v a 2 s . c o m*/ ReviewElement reviewElement = new ReviewElement(); ScrollablePanel reviewPanel = new ScrollablePanel(); reviewPanel.setLayout(new BoxLayout(reviewPanel, BoxLayout.PAGE_AXIS)); JTextField title = new JTextField("NEW REVIEW " + reviewId); title.setBackground(Color.pink); reviewPanel.add(title); JTextArea reviewContentTxtArea = new JTextArea(); reviewContentTxtArea.setLineWrap(true); reviewContentTxtArea.setWrapStyleWord(true); reviewContentTxtArea.setEditable(false); reviewContentTxtArea.setText(review.getRawContent()); int chainId = 0; for (CorefChain cc : review.getCorefChains()) { for (int npId : cc.getChain()) { NounPhrase np = review.getNounPhrases().get(npId); Object highlighTag = reviewContentTxtArea.getHighlighter().addHighlight(np.getOffsetBegin(), np.getOffsetEnd() + 1, highlightPainters.get(chainId)); this.markupReviews.get(reviewId).getNounPhrases().get(npId).highlighterTag = highlighTag; } ++chainId; } reviewPanel.add(reviewContentTxtArea); ScrollablePanel markupsPanel = new ScrollablePanel(); markupsPanel.setLayout(new BoxLayout(markupsPanel, BoxLayout.PAGE_AXIS)); for (int i = 0; i < review.getNounPhrases().size(); ++i) { JScrollPane newMarkupPanel = newMarkupPanel(review.getNounPhrases().get(i), reviewElement); markupsPanel.add(newMarkupPanel); } JScrollPane scrollMarkupsPanel = new JScrollPane(markupsPanel); //Add Dimension for scrolling Dimension curScreenDimen = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); scrollMarkupsPanel.setPreferredSize(new Dimension((int) curScreenDimen.getWidth() - 50, 400)); reviewPanel.add(scrollMarkupsPanel); //MODEL reviewElement.reviewTextArea = reviewContentTxtArea; reviewElements.add(reviewElement); reviewPanel.add(new JSeparator(SwingConstants.HORIZONTAL)); reviewPanel.add(Box.createVerticalStrut(20)); JScrollPane scrollReviewPanel = new JScrollPane(reviewPanel); return scrollReviewPanel; }
From source file:PickTest.java
private void setupGUI(JPanel panel) { ButtonGroup bg;//from w ww.ja v a 2s .c o m panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.setBorder(new BevelBorder(BevelBorder.RAISED)); panel.add(new JLabel(pickModeString)); bg = new ButtonGroup(); addRadioButton(panel, bg, pickModeString, boundsString, true); addRadioButton(panel, bg, pickModeString, geometryString, false); addRadioButton(panel, bg, pickModeString, geometryIntersectString, false); panel.add(new JLabel(toleranceString)); bg = new ButtonGroup(); addRadioButton(panel, bg, toleranceString, tolerance0String, false); addRadioButton(panel, bg, toleranceString, tolerance2String, true); addRadioButton(panel, bg, toleranceString, tolerance4String, false); addRadioButton(panel, bg, toleranceString, tolerance8String, false); panel.add(new JLabel(viewModeString)); bg = new ButtonGroup(); addRadioButton(panel, bg, viewModeString, perspectiveString, true); addRadioButton(panel, bg, viewModeString, parallelString, false); }
From source file:medsavant.uhn.cancer.UserCommentApp.java
private JPanel getMainCommentPanel(Map<OntologyTerm, Collection<UserComment>> otCommentMap, final UserCommentGroup lcg, final VariantRecord vr) { JPanel innerPanel = new JPanel(); //Todo: may need to specify width of this panel? innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.Y_AXIS)); for (final Map.Entry<OntologyTerm, Collection<UserComment>> e : otCommentMap.entrySet()) { OntologyTerm ot = e.getKey();/* ww w . j a v a 2s . co m*/ Collection<UserComment> userComments = e.getValue(); JPanel otPanel = new JPanel(); otPanel.setLayout(new BoxLayout(otPanel, BoxLayout.Y_AXIS)); //otPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); //Define horizontal panel with ontology title and reply to ontology icon. JPanel ontologyTitlePanel = getOntologyTitlePanel(vr, ot); otPanel.add(ontologyTitlePanel); UserComment oldComment = null; for (final UserComment userComment : userComments) { if (userComment.isDeleted()) { continue; } updateStatusPanel(oldComment); otPanel.add(getCommentBlock(lcg, userComment)); oldComment = userComment; } updateStatusPanel(oldComment); otPanel.add(getOntologySeparator()); innerPanel.add(otPanel); } return innerPanel; }