Java Code Examples for javax.swing.BoxLayout#Y_AXIS
The following examples show how to use
javax.swing.BoxLayout#Y_AXIS .
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: SourceProductList.java From snap-desktop with GNU General Public License v3.0 | 6 votes |
/** * Creates an array of two JPanels. The first panel contains a list displaying the chosen products. The second panel * contains buttons for adding and removing products, laid out in configurable direction. Note that it makes only sense * to use both components. * * @return an array of two JPanels. */ private JComponent[] createComponents() { JPanel listPanel = new JPanel(new BorderLayout()); final JScrollPane scrollPane = new JScrollPane(inputPathsList); scrollPane.setPreferredSize(new Dimension(100, 50)); listPanel.add(scrollPane, BorderLayout.CENTER); final JPanel addRemoveButtonPanel = new JPanel(); int axis = this.xAxis ? BoxLayout.X_AXIS : BoxLayout.Y_AXIS; final BoxLayout buttonLayout = new BoxLayout(addRemoveButtonPanel, axis); addRemoveButtonPanel.setLayout(buttonLayout); addRemoveButtonPanel.add(createAddInputButton()); addRemoveButtonPanel.add(createRemoveInputButton()); JPanel[] panels = new JPanel[2]; panels[0] = listPanel; panels[1] = addRemoveButtonPanel; return panels; }
Example 2
Source File: TraceTablePanelSettingDialog.java From pega-tracerviewer with Apache License 2.0 | 6 votes |
private JPanel getMainJPanel() { JPanel mainJPanel = new JPanel(); LayoutManager layout = new BoxLayout(mainJPanel, BoxLayout.Y_AXIS); mainJPanel.setLayout(layout); JPanel settingsJPanel = getSettingsJPanel(); JPanel buttonsJPanel = getButtonsJPanel(); mainJPanel.add(settingsJPanel); mainJPanel.add(Box.createRigidArea(new Dimension(4, 2))); mainJPanel.add(buttonsJPanel); mainJPanel.add(Box.createRigidArea(new Dimension(4, 4))); // mainJPanel.add(Box.createHorizontalGlue()); return mainJPanel; }
Example 3
Source File: LabeledComboBox.java From incubator-iotdb with Apache License 2.0 | 6 votes |
LabeledComboBox(Map<K, V> itemMap, ComboSelectedCallback callback, String labelText) { super(BoxLayout.Y_AXIS); JLabel label = new JLabel(labelText); add(label); Vector vector = new Vector(itemMap.keySet()); vector.sort(null); comboBoxModel = new DefaultComboBoxModel(vector); comboBox = new JComboBox(comboBoxModel); comboBox.setSelectedIndex(-1); add(comboBox); comboBox.addItemListener(e -> { K key = (K) e.getItem(); callback.call(itemMap.get(key)); }); }
Example 4
Source File: Toolbar.java From Logisim with GNU General Public License v3.0 | 6 votes |
public void setOrientation(Object value) { int axis; String position; if (value == HORIZONTAL) { axis = BoxLayout.X_AXIS; position = BorderLayout.LINE_START; } else if (value == VERTICAL) { axis = BoxLayout.Y_AXIS; position = BorderLayout.NORTH; } else { throw new IllegalArgumentException(); } this.remove(subpanel); subpanel.setLayout(new BoxLayout(subpanel, axis)); this.add(subpanel, position); this.orientation = value; }
Example 5
Source File: ConnectionSettingsUI.java From LoboBrowser with MIT License | 6 votes |
private Component getProxyBox() { final Box radioBox = new Box(BoxLayout.Y_AXIS); radioBox.setPreferredSize(new Dimension(600, 200)); radioBox.add(this.noProxyRadioButton); radioBox.add(this.httpProxyRadioButton); radioBox.add(this.socksProxyRadioButton); final Box radioBoxExpander = new Box(BoxLayout.X_AXIS); radioBoxExpander.add(radioBox); radioBoxExpander.add(Box.createGlue()); final Box box = SwingTasks.createGroupBox(BoxLayout.Y_AXIS, "Proxy"); box.add(radioBoxExpander); box.add(this.getProxyHostArea()); return box; }
Example 6
Source File: ItemEditorDialog.java From LoboBrowser with MIT License | 6 votes |
private void init() { this.captionLabel.setPreferredSize(new Dimension(Short.MAX_VALUE, 32)); this.captionLabel.setAlignmentX(0.0f); this.captionLabel.setBorder(new EmptyBorder(8, 0, 8, 0)); this.okButton.setAction(new OkAction()); this.okButton.setText("OK"); this.cancelButton.setAction(new CancelAction()); this.cancelButton.setText("Cancel"); // this.editor.setBorder(new BevelBorder(BevelBorder.RAISED)); final Box rootBox = new Box(BoxLayout.Y_AXIS); rootBox.setBorder(new EmptyBorder(4, 4, 4, 4)); rootBox.add(this.captionLabel); rootBox.add(this.editor); rootBox.add(this.createButtonPanel()); final Container contentPane = this.getContentPane(); contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS)); contentPane.add(rootBox); }
Example 7
Source File: TableBox.java From sc2gears with Apache License 2.0 | 6 votes |
/** * Creates a new TableBox. * @param table table to be wrapped * @param rootComponent root component to register filter hotkeys at * @param wordCloudTableInput optional parameter, if provided, a Word Cloud link will be added * which will open a Word Cloud dialog taking its input from the table as specified by this object */ public TableBox( final JTable table, final JComponent rootComponent, final WordCloudTableInput wordCloudTableInput ) { super( BoxLayout.Y_AXIS ); add( filterComponentsWrapper = createTableFilterComponent( table, rootComponent, wordCloudTableInput ) ); add( table.getTableHeader() ); add( new JScrollPane( table ) ); table.getTableHeader().addMouseMotionListener( new MouseAdapter() { @Override public void mouseMoved( final MouseEvent event ) { final int column = table.getTableHeader().getColumnModel().getColumnIndexAtX( event.getX() ); table.getTableHeader().setToolTipText( table.getColumnName( column ) ); } } ); }
Example 8
Source File: ElementsTableComponent.java From mzmine2 with GNU General Public License v2.0 | 5 votes |
public ElementsTableComponent() { super(new BorderLayout()); elementsTableModel = new ElementsTableModel(); elementsTable = new JTable(elementsTableModel); elementsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); elementsTable.setRowSelectionAllowed(true); elementsTable.setColumnSelectionAllowed(false); elementsTable.setDefaultRenderer(Object.class, new ComponentCellRenderer(smallFont)); elementsTable.getTableHeader().setReorderingAllowed(false); elementsTable.getTableHeader().setResizingAllowed(false); elementsTable.setPreferredScrollableViewportSize(new Dimension(200, 80)); JScrollPane elementsScroll = new JScrollPane(elementsTable); add(elementsScroll, BorderLayout.CENTER); // Add buttons JPanel buttonsPanel = new JPanel(); BoxLayout buttonsPanelLayout = new BoxLayout(buttonsPanel, BoxLayout.Y_AXIS); buttonsPanel.setLayout(buttonsPanelLayout); addElementButton = GUIUtils.addButton(buttonsPanel, "Add", null, this); removeElementButton = GUIUtils.addButton(buttonsPanel, "Remove", null, this); add(buttonsPanel, BorderLayout.EAST); this.setPreferredSize(new Dimension(300, 100)); }
Example 9
Source File: FileChooserEditor.java From niftyeditor with Apache License 2.0 | 5 votes |
private JPanel createAccessor(){ JPanel result = new JPanel(); BoxLayout layout = new BoxLayout(result, BoxLayout.Y_AXIS); result.setLayout(layout); absolute = new JRadioButton("Absolute path"); relative = new JRadioButton("Relative to Assets folder"); copy = new JRadioButton("Copy file in Assets folder"); copy.addActionListener(this); JTextField absText = new JTextField(); absText.setEditable(false); JTextField relText = new JTextField(); relText.setEditable(false); copyText = new JTextField(); copyText.setMaximumSize(new Dimension(400, 25)); copyText.setEnabled(false); group = new ButtonGroup(); group.add(copy); group.add(relative); group.add(absolute); absolute.setSelected(true); result.add(new ImagePreview(jFileChooser1)); result.add(absolute); result.add(relative); result.add(copy); result.add(copyText); result.add(new JPanel()); return result; }
Example 10
Source File: ShapeSelectionPanel.java From settlers-remake with MIT License | 5 votes |
/** * Constructor */ public ShapeSelectionPanel() { super(BoxLayout.Y_AXIS); JToolBar tb = new JToolBar(); tb.setFloatable(false); ButtonGroup group = new ButtonGroup(); for (EShapeType type : EShapeType.values()) { JToggleButton bt = new JToggleButton(type.getIcon()); bt.setDisabledIcon(type.getIcon().createDisabledIcon()); bt.setSelectedIcon(type.getIcon().createSelectedIcon()); bt.setToolTipText(type.getShape().getName()); bt.addActionListener(new ShapeActionListener(type.getShape())); bt.setEnabled(false); tb.add(bt); group.add(bt); buttons.put(type, bt); } add(tb); for (EShapeProperty p : EShapeProperty.values()) { StrokenSlider slider = new StrokenSlider(p); properties.put(p, slider); add(slider); } updateStrokeProperties(); }
Example 11
Source File: FilePathRepair.java From TrakEM2 with GNU General Public License v3.0 | 5 votes |
private final Runnable makeGUI() { return new Runnable() { public void run() { JScrollPane jsp = new JScrollPane(table); jsp.setPreferredSize(new Dimension(500, 500)); table.addMouseListener(listener); JLabel label = new JLabel("Double-click any to repair file path:"); JLabel label2 = new JLabel("(Any listed with identical parent folder will be fixed as well.)"); JPanel plabel = new JPanel(); BoxLayout pbl = new BoxLayout(plabel, BoxLayout.Y_AXIS); plabel.setLayout(pbl); //plabel.setBorder(new LineBorder(Color.black, 1, true)); plabel.setMinimumSize(new Dimension(400, 40)); plabel.add(label); plabel.add(label2); JPanel all = new JPanel(); BoxLayout bl = new BoxLayout(all, BoxLayout.Y_AXIS); all.setLayout(bl); all.add(plabel); all.add(jsp); frame.getContentPane().add(all); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent we) { synchronized (projects) { if (data.vpath.size() > 0 ) { Utils.logAll("WARNING: Some images remain associated to inexistent file paths."); } projects.remove(project); } } }); frame.pack(); ij.gui.GUI.center(frame); frame.setVisible(true); }}; }
Example 12
Source File: MainFrame.java From ShootPlane with Apache License 2.0 | 5 votes |
private void popupScorePanel(List<Score> sortedScoreList) { Container c = this.getContentPane(); c.removeAll(); this.repaint(); if (this.popupScorePanel == null) { this.popupScorePanel = new Top10ScorePanel(this); } this.popupScorePanel.loadScore(sortedScoreList); BoxLayout boxLayout = new BoxLayout(c, BoxLayout.Y_AXIS); c.setLayout(boxLayout); c.add(Box.createVerticalGlue()); c.add(this.popupScorePanel); c.add(Box.createVerticalGlue()); this.validate(); }
Example 13
Source File: ConstellationDialog.java From constellation with Apache License 2.0 | 5 votes |
public ConstellationDialog() { fxPanel = new JFXPanel(); final BoxLayout layout = new BoxLayout(fxPanel, BoxLayout.Y_AXIS); fxPanel.setLayout(layout); fxPanel.setOpaque(false); fxPanel.setBackground(TRANSPARENT); }
Example 14
Source File: MainDetailPanel.java From mars-sim with GNU General Public License v3.0 | 4 votes |
/** * Constructor */ private CustomBox() { super(BoxLayout.Y_AXIS); setBorder(new MarsPanelBorder()); }
Example 15
Source File: DownloadDialog.java From LoboBrowser with MIT License | 4 votes |
public DownloadDialog(final ClientletResponse response, final @NonNull URL url, final int transferSpeed, final UserAgentContext uaContext) { this.url = url; this.uaContext = uaContext; this.setIconImage(DefaultWindowFactory.getInstance().getDefaultImageIcon(uaContext).getImage()); this.topFormPanel.setMinLabelWidth(100); this.bottomFormPanel.setMinLabelWidth(100); this.bottomFormPanel.setEnabled(false); this.documentField.setCaption("Document:"); this.timeLeftField.setCaption("Estimated time:"); this.mimeTypeField.setCaption("MIME type:"); this.sizeField.setCaption("Size:"); this.destinationField.setCaption("File:"); this.transferSizeField.setCaption("Transfer size:"); this.transferRateField.setCaption("Transfer rate:"); this.openFolderButton.setVisible(false); this.openButton.setVisible(false); this.documentField.setValue(url.toExternalForm()); this.mimeTypeField.setValue(response.getMimeType()); final int cl = response.getContentLength(); this.knownContentLength = cl; final String sizeText = cl == -1 ? "Not known" : getSizeText(cl); this.sizeField.setValue(sizeText); final String estTimeText = (transferSpeed <= 0) || (cl == -1) ? "Not known" : Timing.getElapsedText(cl / transferSpeed); this.timeLeftField.setValue(estTimeText); final Container contentPane = this.getContentPane(); contentPane.setLayout(new FlowLayout()); final Box rootPanel = new Box(BoxLayout.Y_AXIS); rootPanel.setBorder(new EmptyBorder(4, 8, 4, 8)); rootPanel.add(this.progressBar); rootPanel.add(Box.createVerticalStrut(8)); rootPanel.add(this.topFormPanel); rootPanel.add(Box.createVerticalStrut(8)); rootPanel.add(this.bottomFormPanel); rootPanel.add(Box.createVerticalStrut(8)); rootPanel.add(this.getButtonsPanel()); contentPane.add(rootPanel); final FormPanel bfp = this.bottomFormPanel; bfp.addField(this.destinationField); bfp.addField(this.transferRateField); bfp.addField(this.transferSizeField); final FormPanel tfp = this.topFormPanel; tfp.addField(this.documentField); tfp.addField(this.mimeTypeField); tfp.addField(this.sizeField); tfp.addField(this.timeLeftField); final Dimension topPanelPs = this.topFormPanel.getPreferredSize(); this.topFormPanel.setPreferredSize(new Dimension(400, topPanelPs.height)); final Dimension bottomPanelPs = this.bottomFormPanel.getPreferredSize(); this.bottomFormPanel.setPreferredSize(new Dimension(400, bottomPanelPs.height)); this.progressBar.setEnabled(false); this.addWindowListener(new WindowAdapter() { @Override public void windowClosed(final WindowEvent e) { final RequestHandler rh = requestHandler; if (rh != null) { rh.cancel(); // So that there's no error dialog requestHandler = null; } } }); }
Example 16
Source File: SettlementTransparentPanel.java From mars-sim with GNU General Public License v3.0 | 4 votes |
public void createAndShowGUI() { emptyLabel = new JLabel(" ") { @Override public Dimension getMinimumSize() { return new Dimension(50, 100); }; @Override public Dimension getPreferredSize() { return new Dimension(50, 100); }; }; buildLabelPane(); buildSettlementNameComboBox(); buildInfoP(); buildrenameBtn(); buildZoomSlider(); buildButtonPane(); nameBtnPane = new JPanel(new FlowLayout()); nameBtnPane.setBackground(new Color(0,0,0)); nameBtnPane.setOpaque(false); nameBtnPane.add(infoP); nameBtnPane.add(renameP); nameBtnPane.add(new JLabel("")); settlementPanel = new JPanel();//new BorderLayout()); settlementPanel.setBackground(new Color(0,0,0,128)); settlementPanel.setOpaque(false); settlementPanel.add(settlementListBox);//, BorderLayout.CENTER); Box box = new Box(BoxLayout.Y_AXIS); box.add(Box.createVerticalGlue()); box.setAlignmentX(JComponent.CENTER_ALIGNMENT); //box.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY)); box.add(Box.createVerticalGlue()); box.setBackground(new Color(0,0,0,128)); box.setOpaque(false); box.add(settlementPanel); box.add(nameBtnPane); mapPanel.add(box, BorderLayout.NORTH); controlCenterPane = new JPanel(new FlowLayout(FlowLayout.CENTER)); controlCenterPane.setBackground(new Color(0,0,0,128));//,0)); controlCenterPane.setOpaque(false); controlCenterPane.setPreferredSize(new Dimension(50, 200)); controlCenterPane.setSize(new Dimension(50, 200)); controlCenterPane.add(zoomSlider); controlPane = new JPanel(new BorderLayout());//GridLayout(2,1,10,2)); controlPane.setBackground(new Color(0,0,0,128));//,0)); controlPane.setOpaque(false); controlPane.add(buttonPane, BorderLayout.NORTH); controlPane.add(labelPane, BorderLayout.SOUTH); controlPane.add(controlCenterPane, BorderLayout.CENTER); eastPane = new JPanel(new BorderLayout());//GridLayout(3,1,10,2)); eastPane.setBackground(new Color(0,0,0,15)); eastPane.setBackground(new Color(0,0,0));//,0)); eastPane.setOpaque(false); eastPane.add(emptyLabel, BorderLayout.EAST); eastPane.add(emptyLabel, BorderLayout.WEST); eastPane.add(emptyLabel, BorderLayout.NORTH); eastPane.add(emptyLabel, BorderLayout.SOUTH); eastPane.add(controlPane, BorderLayout.CENTER); mapPanel.add(eastPane, BorderLayout.EAST); // Make panel drag-able // ComponentMover cmZoom = new ComponentMover(zoomPane); //cmZoom.registerComponent(rightPane); // cmZoom.registerComponent(zoomPane); mapPanel.setVisible(true); }
Example 17
Source File: DragAndDropReorderPane.java From runelite with BSD 2-Clause "Simplified" License | 4 votes |
private DragAndDropReorderLayoutManager() { super(DragAndDropReorderPane.this, BoxLayout.Y_AXIS); }
Example 18
Source File: VideoCaptureComponent.java From COMP3204 with BSD 3-Clause "New" or "Revised" License | 4 votes |
/** * Construct with the given dimensions * * @param width * the width * @param height * the height * @throws VideoCaptureException */ public VideoCaptureComponent(int width, int height) throws VideoCaptureException { super(BoxLayout.Y_AXIS); this.setOpaque(false); this.width = width; this.height = height; final List<Device> devices = VideoCapture.getVideoDevices(); Video<MBFImage> vc = null; if (devices == null || devices.size() == 0) { currentDevice = null; final MBFImage[] frames = { new MBFImage(width, height, ColourSpace.RGB) }; frames[0].fill(RGBColour.RED); vc = new ArrayBackedVideo<MBFImage>(frames); } else { for (final Device d : devices) { if (d.getNameStr().contains("FaceTime")) { currentDevice = d; break; } } if (currentDevice == null) currentDevice = devices.get(0); vc = new VideoCapture(width, height, currentDevice); } final JPanel videoDisplayPanel = new JPanel(); videoDisplayPanel.setOpaque(false); display = VideoDisplay.createVideoDisplay(vc, videoDisplayPanel); add(videoDisplayPanel); final JPanel sourcesPanel = new JPanel(); sourcesPanel.setOpaque(false); sources = new JComboBox<String>(); sources.setOpaque(false); if (devices == null || devices.size() == 0) { sources.addItem("No cameras found"); sources.setEnabled(false); } else { for (final Device s : devices) sources.addItem(s.getNameStr()); } sources.addItemListener(this); sourcesPanel.add(sources); add(sourcesPanel); }
Example 19
Source File: RocLinesPanel.java From rtg-tools with BSD 2-Clause "Simplified" License | 4 votes |
RocLinesPanel(RocPlot rocPlot) { super(BoxLayout.Y_AXIS); mRocPlot = rocPlot; }
Example 20
Source File: AbstractUndoableMovesPanel.java From triplea with GNU General Public License v3.0 | 4 votes |
private JComponent newComponentForMove(final AbstractUndoableMove move) { final Box unitsBox = new Box(BoxLayout.X_AXIS); unitsBox.add(new JLabel((move.getIndex() + 1) + ") ")); final Collection<UnitCategory> unitCategories = UnitSeparator.categorize(move.getUnits()); final Dimension buttonSize = new Dimension(80, 22); for (final UnitCategory category : unitCategories) { final Optional<ImageIcon> icon = movePanel .getMap() .getUiContext() .getUnitImageFactory() .getIcon( category.getType(), category.getOwner(), category.hasDamageOrBombingUnitDamage(), category.getDisabled()); if (icon.isPresent()) { final JLabel label = new JLabel("x" + category.getUnits().size() + " ", icon.get(), SwingConstants.LEFT); unitsBox.add(label); MapUnitTooltipManager.setUnitTooltip( label, category.getType(), category.getOwner(), category.getUnits().size()); } } unitsBox.add(Box.createHorizontalGlue()); final JLabel text = new JLabel(move.getMoveLabel()); final Box textBox = new Box(BoxLayout.X_AXIS); textBox.add(text); textBox.add(Box.createHorizontalGlue()); final JButton cancelButton = new JButton(new UndoMoveActionListener(move.getIndex())); setSize(buttonSize, cancelButton); final JButton viewbutton = new JButton(new ViewAction(move)); setSize(buttonSize, viewbutton); final Box buttonsBox = new Box(BoxLayout.X_AXIS); buttonsBox.add(viewbutton); buttonsBox.add(cancelButton); buttonsBox.add(Box.createHorizontalGlue()); final Box containerBox = new Box(BoxLayout.Y_AXIS); containerBox.add(unitsBox); containerBox.add(textBox); containerBox.add(buttonsBox); containerBox.add(new JLabel(" ")); return containerBox; }