类javax.swing.BoxLayout源码实例Demo

下面列出了怎么用javax.swing.BoxLayout的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: netbeans   文件: QBNodeComponent.java
public QBNodeComponent(String nodeName, QueryBuilderTableModel queryBuilderTableModel)
   {
       // Set some private variables
       _queryBuilderTableModel = queryBuilderTableModel;
_nodeName = nodeName;

       // Create a JTable component, with the specified TableModel behind it
       _qbTable = new QueryBuilderTable(_queryBuilderTableModel);
       _qbTable.setBackground(Color.white); 
       
       // Wrap the JTable in a JScrollPane
       JScrollPane sp = new JScrollPane(_qbTable);
       sp.getViewport().setBackground(Color.white); 
       
       // Wrap the JScrollPane in a JPanel
       this.add(sp,BorderLayout.CENTER);
       this.setBackground(Color.white);
       this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
this.setPreferredSize(new Dimension(175,80));

// Only applies to JInternalFrame
       // setResizable(true);
       
       // setVisible(true);
   }
 
源代码2 项目: jdk8u-jdk   文件: Test4903007.java
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;
}
 
源代码3 项目: ehacks-pro   文件: EditPacketBlackList.java
public EditPacketBlackList(Gui gui) {
    super("PacketLogger blacklist");
    this.gui = gui;
    this.setLayout(new BoxLayout(this.getContentPane(), 1));
    this.buttonsPanel.setLayout(new FlowLayout());
    this.construct();
    this.addToLists();
    this.reset.addActionListener(this);
    this.accept.addActionListener(this);
    this.buttonsPanel.add(this.reset);
    this.buttonsPanel.add(this.accept);
    this.add(this.buttonsPanel);
    this.pack();
    this.setLocationRelativeTo(null);
    this.setResizable(false);
    this.setAlwaysOnTop(true);
    this.setVisible(true);
}
 
源代码4 项目: jadx   文件: ProgressPanel.java
public ProgressPanel(final MainWindow mainWindow, boolean showCancelButton) {
	this.showCancelButton = showCancelButton;

	progressLabel = new JLabel();
	progressBar = new JProgressBar(0, 100);
	progressBar.setIndeterminate(true);
	progressBar.setStringPainted(false);
	progressLabel.setLabelFor(progressBar);

	setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
	setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
	setVisible(false);
	add(progressLabel);
	add(progressBar);

	cancelButton = new JButton(ICON_CANCEL);
	cancelButton.setPreferredSize(new Dimension(ICON_CANCEL.getIconWidth(), ICON_CANCEL.getIconHeight()));
	cancelButton.setToolTipText("Cancel background jobs");
	cancelButton.setBorderPainted(false);
	cancelButton.setFocusPainted(false);
	cancelButton.setContentAreaFilled(false);
	cancelButton.addActionListener(e -> mainWindow.cancelBackgroundJobs());
	cancelButton.setVisible(showCancelButton);
	add(cancelButton);
}
 
源代码5 项目: jdal   文件: SeparatorTitled.java
public SeparatorTitled(String title, boolean bold) {

	super(BoxLayout.LINE_AXIS);
	JLabel titleLabel = new JLabel(title);
	
	if (bold)
		FormUtils.setBold(titleLabel);
	
	titleLabel.setAlignmentY(Component.BOTTOM_ALIGNMENT);
	this.add(titleLabel);
	this.add(Box.createHorizontalStrut(5));
	JSeparator separator = new JSeparator();
	separator.setAlignmentY(Container.TOP_ALIGNMENT);
	this.add(separator);
	this.setMaximumSize(new Dimension(Short.MAX_VALUE, 20));
}
 
源代码6 项目: osv   文件: MapPanel.java
public MapPanel(MainWindow mw) {

		this.mw = mw;
		this.setOpaque(false);

		cp = new JPanel();
		cp.setLayout(new BoxLayout(cp, BoxLayout.Y_AXIS));
		cp.setOpaque(false);
		verticalSpace = new OSVEmptyPanel(mw, 0, 0.28f);
		cp.add(verticalSpace);

		mapDisplay = new MapDisplay();
		mapDisplay.setOpaque(false);

		cp.add(mapDisplay);

		add(cp);
	}
 
@Override
protected JPanel createParametersPanel() {
    JPanel paramsPanel = new JPanel();
    BoxLayout layout = new BoxLayout(paramsPanel, BoxLayout.PAGE_AXIS);
    paramsPanel.setLayout(layout);
    AbstractButton addParamBut = ToolButtonFactory.createButton(UIUtils.loadImageIcon(Bundle.Icon_Add()), false);
    addParamBut.setText("New Parameter");
    addParamBut.setMaximumSize(new Dimension(150, controlHeight));
    addParamBut.setAlignmentX(Component.LEFT_ALIGNMENT);
    addParamBut.setAlignmentY(Component.TOP_ALIGNMENT);
    paramsPanel.add(addParamBut);
    JScrollPane tableScrollPane = new JScrollPane(paramsTable);
    tableScrollPane.setAlignmentX(Component.LEFT_ALIGNMENT);
    paramsPanel.add(tableScrollPane);
    addParamBut.addActionListener(e -> paramsTable.addParameterToTable());
    return paramsPanel;
}
 
源代码8 项目: opensim-gui   文件: MeasurementSetPanel.java
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    measurementSetWithTitlePanel = new javax.swing.JPanel();

    measurementSetWithTitlePanel.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    measurementSetWithTitlePanel.setLayout(new javax.swing.BoxLayout(measurementSetWithTitlePanel, javax.swing.BoxLayout.Y_AXIS));

    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
        .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
            .addContainerGap()
            .add(measurementSetWithTitlePanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 520, Short.MAX_VALUE)
            .addContainerGap())
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
        .add(layout.createSequentialGroup()
            .addContainerGap()
            .add(measurementSetWithTitlePanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 242, Short.MAX_VALUE)
            .addContainerGap())
    );
}
 
源代码9 项目: sldeditor   文件: ExpressionSubPanel.java
/** Sets the up literal panel. */
protected void setUpLiteralPanel() {
    panelLiteral = new JPanel();
    panelLiteral.setBorder(null);
    panelLiteral.setLayout(new BoxLayout(panelLiteral, BoxLayout.X_AXIS));

    rdbtnLiteral =
            new JRadioButton(
                    Localisation.getString(
                            ExpressionPanelv2.class, "ExpressionPanelv2.literal"));
    rdbtnLiteral.setMinimumSize(new Dimension(100, 20));
    rdbtnLiteral.setPreferredSize(new Dimension(100, 20));
    panelLiteral.add(rdbtnLiteral);
    rdbtnLiteral.setActionCommand(LITERAL);
    buttonGroup.add(rdbtnLiteral);
    box.add(panelLiteral);
}
 
源代码10 项目: mzmine2   文件: PeakSelectionComponent.java
public PeakSelectionComponent() {

    super(new BorderLayout());

    selectionListModel = new DefaultListModel<PeakSelection>();
    selectionList = new JList<>(selectionListModel);
    selectionList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    selectionList.setPreferredSize(new Dimension(200, 50));
    JScrollPane scrollPane = new JScrollPane(selectionList);
    add(scrollPane, BorderLayout.CENTER);

    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.Y_AXIS));
    addButton = GUIUtils.addButton(buttonPanel, "Add", null, this);
    removeButton = GUIUtils.addButton(buttonPanel, "Remove", null, this);
    allButton = GUIUtils.addButton(buttonPanel, "Set to all", null, this);
    clearButton = GUIUtils.addButton(buttonPanel, "Clear", null, this);

    add(buttonPanel, BorderLayout.EAST);
  }
 
源代码11 项目: pega-tracerviewer   文件: TracerDataMainPanel.java
private JPanel getTracerInfoJPanel() {

        JPanel infoJPanel = new JPanel();

        LayoutManager layout = new BoxLayout(infoJPanel, BoxLayout.X_AXIS);
        infoJPanel.setLayout(layout);

        // Dimension preferredSize = new Dimension(300, 30);
        // infoJPanel.setPreferredSize(preferredSize);

        JPanel incompleteTracerJPanel = getIncompleteTracerJPanel();
        JPanel charsetJPanel = getCharsetJPanel();
        JPanel sizeJPanel = getSizeJPanel();

        infoJPanel.add(incompleteTracerJPanel);
        infoJPanel.add(charsetJPanel);
        infoJPanel.add(sizeJPanel);

        return infoJPanel;
    }
 
源代码12 项目: arcusplatform   文件: MockActionsDialog.java
private Component createActions(List<MockAction> actions) {
   JPanel panel = new JPanel();
   panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
   for (MockAction mockAction : actions) {
      Action action = Actions.build(mockAction.getName(), new DoItDammit(mockAction));
      panel.add(new JButton(action));
   }
   return panel;
}
 
源代码13 项目: arcusplatform   文件: Wizard.java
protected Wizard(WizardStep<I, ?> first, WizardStep<?, O> last) {
   this.first = first;
   this.current = first;
   this.last = last;

   GridBagConstraints gbc = new GridBagConstraints();
   
   gbc.gridx = 0;
   gbc.gridy = 0;
   gbc.fill = GridBagConstraints.BOTH;
   gbc.weightx = 1.0;
   gbc.weighty = 1.0;
   contents.add(new JLabel(), gbc.clone());
   
   gbc.fill = GridBagConstraints.HORIZONTAL;
   gbc.weightx = 1.0;
   gbc.weighty = 0.0;
   gbc.gridy++;
   contents.add(new JSeparator(JSeparator.HORIZONTAL), gbc.clone());
   
   JPanel buttons = new JPanel();
   buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS));
   buttons.add(back);
   buttons.add(Box.createHorizontalGlue());
   buttons.add(next);
   
   gbc.gridy++;
   contents.add(buttons, gbc.clone());
}
 
源代码14 项目: 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;
}
 
源代码15 项目: jdk8u-jdk   文件: TestBox.java
public static void main(String[] args) {
    TestEncoder.test(
            new Box(BoxLayout.LINE_AXIS),
            new Box(BoxLayout.PAGE_AXIS) {
                @Override
                public FlowLayout getLayout() {
                    return new FlowLayout() {
                        private final Object axis = OBJECT;
                    };
                }
            },
            OBJECT
    );
}
 
源代码16 项目: COMP3204   文件: TomatoKNNClassifierDemo.java
private JPanel createColourSpaceButtons() {
	final JPanel colourspacesPanel = new JPanel();
	colourspacesPanel.setOpaque(false);
	colourspacesPanel.setLayout(new BoxLayout(colourspacesPanel, BoxLayout.X_AXIS));
	colourspacesPanel.setAlignmentX(Component.CENTER_ALIGNMENT);
	final ButtonGroup group = new ButtonGroup();
	createRadioButton(colourspacesPanel, group, ColourSpace.HUE);
	createRadioButton(colourspacesPanel, group, ColourSpace.HS);
	createRadioButton(colourspacesPanel, group, ColourSpace.H1H2);
	return colourspacesPanel;
}
 
源代码17 项目: sldeditor   文件: ExpressionSubPanel.java
/** Sets the up maths panel. */
protected void setUpMathsPanel() {
    JPanel panelMaths = new JPanel();
    panelMaths.setBorder(null);
    panelMaths.setLayout(new BoxLayout(panelMaths, BoxLayout.X_AXIS));
    rdbtnMaths =
            new JRadioButton(
                    Localisation.getString(ExpressionPanelv2.class, "ExpressionPanelv2.maths"));
    panelMaths.add(rdbtnMaths);
    rdbtnMaths.setMinimumSize(new Dimension(100, 20));
    rdbtnMaths.setPreferredSize(new Dimension(100, 20));
    rdbtnMaths.setActionCommand(MATHS);
    buttonGroup.add(rdbtnMaths);

    mathsExpressionPanel =
            new MathsExpressionPanel(
                    new SubPanelUpdatedInterface() {
                        @Override
                        public void updateSymbol() {
                            buttonGroup.setSelected(rdbtnMaths.getModel(), true);
                            updateButtonState(true);
                        }

                        @Override
                        public void parameterAdded() {
                            // Do nothing
                        }
                    });

    panelMaths.add(mathsExpressionPanel);
    box.add(panelMaths);
}
 
源代码18 项目: Repeat   文件: SwingUtil.java
/**
 * Get input from a number of fields from user
 * @param titles titles of the fields that requires input
 * @return a list of input values entered by user, or null if user cancels input windows
 */
public static String[] getInputs(String[] titles) {
	if (titles.length == 0) {
		return null;
	}

	JTextField[] textFields = new JTextField[titles.length];
	String[] output = new String[titles.length];

	JPanel mainPanel = new JPanel();
	mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));

	for (int i = 0; i < titles.length; i++) {
		JPanel myPanel = new JPanel();
		if (titles[i] != null) {
			myPanel.add(new JLabel(titles[i]));
		} else {
			myPanel.add(new JLabel(i + ")"));
		}
		textFields[i] = new JTextField(10);
		textFields[i].setText("");
		myPanel.add(textFields[i]);
		mainPanel.add(myPanel);
	}

	int result = JOptionPane.showConfirmDialog(null, mainPanel,
			"Enter values", JOptionPane.OK_CANCEL_OPTION);

	if (result == JOptionPane.OK_OPTION) {
		for (int i = 0; i < titles.length; i++) {
			output[i] = textFields[i].getText();
		}
		return output;
	} else {
		return null;
	}
}
 
源代码19 项目: PacketProxy   文件: GUIOptionListenPortDialog.java
private JComponent label_and_object(String label_name, JComponent object) {
	JPanel panel = new JPanel();
	panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
	JLabel label = new JLabel(label_name);
	label.setPreferredSize(new Dimension(150, label.getMaximumSize().height));
	panel.add(label);
	object.setMaximumSize(new Dimension(Short.MAX_VALUE, label.getMaximumSize().height * 2));
	panel.add(object);
	return panel;
}
 
源代码20 项目: PacketProxy   文件: GUIOptionListenPortDialog.java
private JComponent buttons() {
	JPanel panel_button = new JPanel();
	panel_button.setLayout(new BoxLayout(panel_button, BoxLayout.X_AXIS));
	panel_button.setMaximumSize(new Dimension(Short.MAX_VALUE, button_set.getMaximumSize().height));
	panel_button.add(button_cancel);
	panel_button.add(button_set);
	return panel_button;
}
 
源代码21 项目: geomajas-project-server   文件: LegendBuilder.java
public void addLayer(String title, Font font, RenderedImage image) {
	JPanel panel = new JPanel();
	panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
	RenderedImageIcon icon = new RenderedImageIcon(image,
			LegendGraphicMetadata.DEFAULT_WIDTH, LegendGraphicMetadata.DEFAULT_HEIGHT);
	JLabel label = new JLabel(icon);
	label.setBorder(new EmptyBorder(ICON_PADDING, ICON_PADDING, ICON_PADDING, ICON_PADDING));
	panel.add(label);
	panel.add(Box.createRigidArea(new Dimension(MEMBER_MARGIN, 0)));
	JLabel itemText = new JLabel(title);
	itemText.setFont(font);
	panel.add(itemText);
	panel.setAlignmentX(JPanel.LEFT_ALIGNMENT);
	legendPanel.add(panel);
}
 
源代码22 项目: PacketProxy   文件: GUIFilterConfigEditDialog.java
private JComponent label_and_object(String label_name, JComponent object, int height) {
	JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
    JLabel label = new JLabel(label_name);
    label.setPreferredSize(new Dimension(150, label.getMaximumSize().height));
    panel.add(label);
    object.setMaximumSize(new Dimension(Short.MAX_VALUE, label.getMaximumSize().height * height));
    panel.add(object);
	return panel;
}
 
源代码23 项目: netbeans   文件: SettingsPanel.java
private static int defaultHeight() {
    if (DEFAULT_HEIGHT == -1) {
        JPanel ref = new JPanel(null);
        ref.setLayout(new BoxLayout(ref, BoxLayout.LINE_AXIS));
        ref.setOpaque(false);
        
        ref.add(new JLabel("XXX")); // NOI18N
        
        ref.add(new JButton("XXX")); // NOI18N
        ref.add(new PopupButton("XXX")); // NOI18N
        
        ref.add(new JCheckBox("XXX")); // NOI18N
        ref.add(new JRadioButton("XXX")); // NOI18N
        
        ref.add(new JTextField("XXX")); // NOI18N
        
        ref.add(new JExtendedSpinner(new SpinnerNumberModel(1, 1, 655535, 1)));
        
        Component separator = Box.createHorizontalStrut(1);
        Dimension d = separator.getMaximumSize(); d.height = 20;
        separator.setMaximumSize(d);
        ref.add(separator);
        
        DEFAULT_HEIGHT = ref.getPreferredSize().height;
    }
    return DEFAULT_HEIGHT;
}
 
源代码24 项目: netbeans   文件: ExpandableMessage.java
ExpandableMessage(String topMsgKey,
                  Collection<String> messages,
                  String bottomMsgKey,
                  JButton toggleButton) {
    super(null);
    this.messages = messages;
    this.toggleButton = toggleButton;
    lblTopMsg = new JLabel(getMessage(topMsgKey));
    lblBotMsg = (bottomMsgKey != null)
                ? new JLabel(getMessage(bottomMsgKey))
                : null;

    setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));

    add(lblTopMsg);
    lblTopMsg.setAlignmentX(LEFT_ALIGNMENT);

    if (lblBotMsg != null) {
        add(makeVerticalStrut(lblTopMsg, lblBotMsg));
        add(lblBotMsg);
        lblBotMsg.setAlignmentX(LEFT_ALIGNMENT);
    }

    Mnemonics.setLocalizedText(toggleButton,
                               getMessage("LBL_ShowMoreInformation")); //NOI18N
    toggleButton.addActionListener(this);
}
 
源代码25 项目: mars-sim   文件: ConstructionSitesPanel.java
/**
   * Constructor
   * @param manager the settlement construction manager.
   */
  public ConstructionSitesPanel(ConstructionManager manager) {
      // Use JPanel constructor.
      super();
      
      this.manager = manager;
      
      setLayout(new BorderLayout());
      setBorder(new MarsPanelBorder());
      
      JPanel titlePanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
      add(titlePanel, BorderLayout.NORTH);
      
      JLabel titleLabel = new JLabel("Construction Sites");
titleLabel.setFont(new Font("Serif", Font.BOLD, 16));
      titlePanel.add(titleLabel);
      
      // Create scroll panel for sites list pane.
      sitesScrollPane = new JScrollPane();
      sitesScrollPane.setPreferredSize(new Dimension(200, 75));
      sitesScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
      add(sitesScrollPane, BorderLayout.CENTER);  
      
      // Prepare sites outer list pane.
      JPanel sitesOuterListPane = new JPanel(new BorderLayout(0, 0));
      sitesScrollPane.setViewportView(sitesOuterListPane);
      
      // Prepare sites list pane.
      sitesListPane = new JPanel();
      sitesListPane.setLayout(new BoxLayout(sitesListPane, BoxLayout.Y_AXIS));
      sitesOuterListPane.add(sitesListPane, BorderLayout.NORTH);
      
      // Create the site panels.
      sitesCache = manager.getConstructionSites();
      Iterator<ConstructionSite> i = sitesCache.iterator();
      while (i.hasNext()) sitesListPane.add(new ConstructionSitePanel(i.next()));
  }
 
源代码26 项目: snap-desktop   文件: AbstractAdapterEditor.java
private AbstractAdapterEditor(AppContext appContext, JDialog parent, String title) {
    super(parent.getOwner(), title, ID_OK_CANCEL_HELP, new Object[] { new JButton(Bundle.CTL_Button_Export_Text()) }, helpID);
    this.context = appContext;
    this.logger = Logger.getLogger(ToolAdapterEditorDialog.class.getName());
    this.registerButton(ID_OTHER, new JButton(Bundle.CTL_Button_Export_Text()));
    controlHeight = (getJDialog().getFont().getSize() + 1) * 2;
    errorPanel = new JPanel();
    errorPanel.setLayout(new BoxLayout(errorPanel, BoxLayout.Y_AXIS));
    getButtonPanel().add(errorPanel, 0);
}
 
源代码27 项目: AML-Project   文件: AddClassMapping.java
private void buildTargetResultsPanel()
{
       //Results panel: contains the list of all classes that match que query
       tResults = new JPanel();
       tResults.setLayout(new BoxLayout(tResults, BoxLayout.PAGE_AXIS));
       //Create a label
       JLabel tLabel = new JLabel("Select a target class from the list of search results or go back to the full class list:");
       JPanel tLPanel = new JPanel();
       tLPanel.add(tLabel);
       tResults.add(tLPanel);
       Vector<String> sNames = new Vector<String>(targetRes.size());
       for(int i : targetRes)
       	sNames.add(target.getBestName(i));
       //Create the search area and button
	targetResult = new JTextArea(1,37);
	targetResult.setText(targetSearch.getText());
	targetResult.setEditable(false);
	targetResult.setBackground(Color.LIGHT_GRAY);
	backT = new JButton("Back");
	backT.setPreferredSize(new Dimension(70,28));
	backT.addActionListener(this);
	//Put them in a subpanel, side by side
	JPanel tSearchPanel = new JPanel();
	tSearchPanel.add(targetResult);
       tSearchPanel.add(backT);
       tResults.add(tSearchPanel);
       //Build the combo box with all the primary class names from the results
       targetResults = new JComboBox<String>(sNames);
       targetResults.setPreferredSize(new Dimension(500,28));
       //Put it in a subpanel so that it doesn't resize automatically
       JPanel tClassPanel = new JPanel();
       tClassPanel.add(targetResults);
       tResults.add(tClassPanel);
}
 
源代码28 项目: jdk8u-jdk   文件: TableExample.java
/**
 * Creates the connectionPanel, which will contain all the fields for
 * the connection information.
 */
public void createConnectionDialog() {
    // Create the labels and text fields.
    userNameLabel = new JLabel("User name: ", JLabel.RIGHT);
    userNameField = new JTextField("app");

    passwordLabel = new JLabel("Password: ", JLabel.RIGHT);
    passwordField = new JTextField("app");

    serverLabel = new JLabel("Database URL: ", JLabel.RIGHT);
    serverField = new JTextField("jdbc:derby://localhost:1527/sample");

    driverLabel = new JLabel("Driver: ", JLabel.RIGHT);
    driverField = new JTextField("org.apache.derby.jdbc.ClientDriver");


    connectionPanel = new JPanel(false);
    connectionPanel.setLayout(new BoxLayout(connectionPanel,
            BoxLayout.X_AXIS));

    JPanel namePanel = new JPanel(false);
    namePanel.setLayout(new GridLayout(0, 1));
    namePanel.add(userNameLabel);
    namePanel.add(passwordLabel);
    namePanel.add(serverLabel);
    namePanel.add(driverLabel);

    JPanel fieldPanel = new JPanel(false);
    fieldPanel.setLayout(new GridLayout(0, 1));
    fieldPanel.add(userNameField);
    fieldPanel.add(passwordField);
    fieldPanel.add(serverField);
    fieldPanel.add(driverField);

    connectionPanel.add(namePanel);
    connectionPanel.add(fieldPanel);
}
 
源代码29 项目: astor   文件: AgeCalculator.java
private void addBottomArea(Container container) {
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));

    ItemListener listener = new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            updateResults();
        }
    };

    iFieldSets = new FieldSet[] {
        new FieldSet("Month Based", new FieldGroup[] {
            new FieldGroup(listener, "Years", YEARS),
            new FieldGroup(listener, "Months", MONTHS),
            new FieldGroup(listener, "Days", DAYS),
            new FieldGroup(listener, "Hours", HOURS),
            new FieldGroup(listener, "Minutes", MINUTES),
            new FieldGroup(listener, "Seconds", SECONDS)
        })
        ,
        new FieldSet("Week Based", new FieldGroup[] {
            new FieldGroup(listener, "Weekyears", WEEKYEARS),
            new FieldGroup(listener, "Weeks", WEEKS),
            new FieldGroup(listener, "Days", DAYS),
            new FieldGroup(listener, "Hours", HOURS),
            new FieldGroup(listener, "Minutes", MINUTES),
            new FieldGroup(listener, "Seconds", SECONDS)
        })
    };

    for (int i=0; i<iFieldSets.length; i++) {
        if (i > 0) {
            panel.add(Box.createHorizontalStrut(10));
        }
        iFieldSets[i].addTo(panel);
    }
    panel.add(Box.createVerticalGlue());

    container.add(fixedHeight(panel));
}
 
源代码30 项目: openjdk-8   文件: TestBox.java
public static void main(String[] args) {
    TestEncoder.test(
            new Box(BoxLayout.LINE_AXIS),
            new Box(BoxLayout.PAGE_AXIS) {
                @Override
                public FlowLayout getLayout() {
                    return new FlowLayout() {
                        private final Object axis = OBJECT;
                    };
                }
            },
            OBJECT
    );
}
 
 类所在包
 同包方法