javax.swing.BoxLayout#Y_AXIS源码实例Demo

下面列出了javax.swing.BoxLayout#Y_AXIS 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: incubator-iotdb   文件: LabeledComboBox.java
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));
  });
}
 
源代码2 项目: sc2gears   文件: TableBox.java
/**
 * 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 ) );
		}
	} );
}
 
源代码3 项目: LoboBrowser   文件: ItemEditorDialog.java
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);
}
 
源代码4 项目: LoboBrowser   文件: ConnectionSettingsUI.java
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;
}
 
源代码5 项目: Logisim   文件: Toolbar.java
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;
}
 
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;
    }
 
源代码7 项目: snap-desktop   文件: SourceProductList.java
/**
 * 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;
}
 
源代码8 项目: constellation   文件: ConstellationDialog.java
public ConstellationDialog() {
    fxPanel = new JFXPanel();
    final BoxLayout layout = new BoxLayout(fxPanel, BoxLayout.Y_AXIS);
    fxPanel.setLayout(layout);
    fxPanel.setOpaque(false);
    fxPanel.setBackground(TRANSPARENT);
}
 
源代码9 项目: ShootPlane   文件: MainFrame.java
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();
   }
 
源代码10 项目: TrakEM2   文件: FilePathRepair.java
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);
	}};
}
 
源代码11 项目: settlers-remake   文件: ShapeSelectionPanel.java
/**
 * 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();
}
 
源代码12 项目: niftyeditor   文件: FileChooserEditor.java
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;
}
 
源代码13 项目: mzmine2   文件: ElementsTableComponent.java
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));

  }
 
源代码14 项目: triplea   文件: AbstractUndoableMovesPanel.java
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;
}
 
源代码15 项目: mars-sim   文件: SettlementTransparentPanel.java
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);
    }
 
源代码16 项目: LoboBrowser   文件: DownloadDialog.java
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;
      }
    }
  });
}
 
源代码17 项目: mars-sim   文件: MainDetailPanel.java
/**
 * Constructor
 */
private CustomBox() {
	super(BoxLayout.Y_AXIS);
	setBorder(new MarsPanelBorder());
}
 
源代码18 项目: runelite   文件: DragAndDropReorderPane.java
private DragAndDropReorderLayoutManager()
{
	super(DragAndDropReorderPane.this, BoxLayout.Y_AXIS);
}
 
源代码19 项目: COMP3204   文件: VideoCaptureComponent.java
/**
 * 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);
}
 
源代码20 项目: rtg-tools   文件: RocLinesPanel.java
RocLinesPanel(RocPlot rocPlot) {
  super(BoxLayout.Y_AXIS);
  mRocPlot = rocPlot;
}
 
 方法所在类