Java 类javax.swing.Box 实例源码

项目:openjdk-jdk10    文件:SchemaTreeTraverser.java   
/**
 * Simple constructor.
 */
public SchemaTreeCellRenderer() {
    FlowLayout fl = new FlowLayout(FlowLayout.LEFT, 1, 1);
    this.setLayout(fl);
    this.iconLabel = new JLabel();
    this.iconLabel.setOpaque(false);
    this.iconLabel.setBorder(null);
    this.add(this.iconLabel);

    // add some space
    this.add(Box.createHorizontalStrut(5));

    this.nameLabel = new JLabel();
    this.nameLabel.setOpaque(false);
    this.nameLabel.setBorder(null);
    this.nameLabel.setFont(nameFont);
    this.add(this.nameLabel);

    this.isSelected = false;

    this.setOpaque(false);
    this.setBorder(null);
}
项目:incubator-netbeans    文件:ConnectionErrorDlg.java   
private void addLine(List<Segment> line) {
    if (line.size() == 1) {
        addSegment(this, line.get(0));
    } else {
        Box lineBox = new Box(BoxLayout.LINE_AXIS);
        if (lineBox.getComponentOrientation().isLeftToRight()) {
            lineBox.setAlignmentX(LEFT_ALIGNMENT);
        } else {
            lineBox.setAlignmentX(RIGHT_ALIGNMENT);
        }
        for (Segment s : line) {
            addSegment(lineBox, s);
        }
        add(lineBox);
    }
}
项目:incubator-netbeans    文件:VerticalLayout.java   
public Dimension minimumLayoutSize(final Container parent) {
    final Insets insets = parent.getInsets();
    final Dimension d = new Dimension(insets.left + insets.right,
                                      insets.top + insets.bottom);
    int maxWidth = 0;
    int visibleCount = 0;

    for (Component comp : parent.getComponents()) {
        if (comp.isVisible() && !(comp instanceof Box.Filler)) {
            final Dimension size = comp.getPreferredSize();
            maxWidth = Math.max(maxWidth, size.width);
            d.height += size.height;
            visibleCount++;
        }
    }

    d.height += (visibleCount - 1) * vGap;
    d.width += maxWidth;

    return d;
}
项目:Equella    文件:ProgressWindow.java   
@Override
public void setup(String title, int total)
{
    JPanel all = new JPanel();
    all.setLayout(new BoxLayout(all, BoxLayout.Y_AXIS));
    all.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    all.add(createHeader());
    all.add(Box.createRigidArea(new Dimension(0, 10)));
    all.add(createWholeProgress(total));
    all.add(Box.createRigidArea(new Dimension(0, 10)));
    all.add(createCurrentProgress());
    all.add(Box.createRigidArea(new Dimension(0, 10)));
    all.add(createMessageArea());
    all.add(Box.createRigidArea(new Dimension(0, 10)));
    all.add(createButtons());

    getContentPane().add(all);
    setTitle(title);
    setSize(500, 500);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    ComponentHelper.centreOnScreen(this);
    setVisible(true);
}
项目:Java_GestionProjet    文件:FenetreOption.java   
/**
 * Initialise le panneau du bouton de validation
 */
private void initPanneauBoutonValidation(){
    this.setPanneauBoutousValidation(new JPanel());
    this.getPanneauBoutousValidation().setLayout(new BoxLayout(this.getPanneauBoutousValidation(), BoxLayout.LINE_AXIS));
    this.getPanneauBoutousValidation().setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);


    this.setBoutonValider(new JButton("Valider"));
    this.setBoutonAnnule(new JButton("Annuler"));

    this.getPanneauBoutousValidation().add(this.getBoutonValider());
    this.getPanneauBoutousValidation().add(Box.createRigidArea(new Dimension(10, 0)));
    this.getPanneauBoutousValidation().add(this.getBoutonAnnule());
    this.getPanneauBoutousValidation().add(Box.createHorizontalGlue());
    this.getContentPane().add(this.getPanneauBoutousValidation());

    this.getPanneauBoutousValidation().setVisible(true);
}
项目:the-one-mdonnyk    文件:SimMenuBar.java   
private void init() {
    JMenu pfMenu = new JMenu("Playfield graphics");
    JMenu help = new JMenu("Help");
    Settings settings = new Settings(UNDERLAY_NS);
    if (settings.contains("fileName")) {
        // create underlay image menu item only if filename is specified 
        enableBgImage = createCheckItem(pfMenu,"Show underlay image",false);
    }
    enableNodeName = createCheckItem(pfMenu, "Show node name string",true);
    enableNodeCoverage = createCheckItem(pfMenu, 
            "Show node radio coverage", true);
    enableNodeConnections = createCheckItem(pfMenu,
            "Show node's connections", true);
    enableMapGraphic = createCheckItem(pfMenu,"Show map graphic",true);
    autoClearOverlay = createCheckItem(pfMenu, "Autoclear overlay",true);
    clearOverlay = createMenuItem(pfMenu,"Clear overlays now");
    about = createMenuItem(help,"about");
    this.add(pfMenu);
    this.add(Box.createHorizontalGlue());
    this.add(help);
}
项目:chipKIT-importer    文件:SerialMonitorDisplayPane.java   
private JComponent createTopPane() {
    inputField = new JTextField(40);
    inputField.addActionListener( (e) -> sendMessage() );
    inputField.setMaximumSize( inputField.getPreferredSize() );

    JButton sendButton = new JButton( getLocalizedComponentText("sendButton") );
    sendButton.addActionListener( (e) -> sendMessage() );

    JPanel pane = new JPanel();
    pane.setLayout( new BoxLayout(pane, BoxLayout.LINE_AXIS) );

    crSwitch = new JToggleButton("CR", true);
    lfSwitch = new JToggleButton("LF", true);

    pane.add( inputField );
    pane.add( Box.createRigidArea( new Dimension(5, 0) ) );
    pane.add( sendButton );
    pane.add( Box.createGlue() );
    pane.add( crSwitch );
    pane.add( Box.createRigidArea( new Dimension(5, 0) ) );
    pane.add( lfSwitch );        

    pane.setBorder( BorderFactory.createEmptyBorder(3, 3, 3, 0) );

    return pane;
}
项目:QN-ACTR-Release    文件:JWatStartScreen.java   
private void initGUI() {
    this.setIconImage(JMTImageLoader.loadImage(IMG_JWATICON).getImage());
    this.setResizable(false);
    this.setTitle("jWAT");
    this.setSize(520, 400);
    //Image image = new ImageIcon(imageURL).getImage();
    //image = image.getScaledInstance(400, 315, Image.SCALE_SMOOTH);
    JPanel eastPanel = new JPanel(new BorderLayout());
    eastPanel.add(Box.createVerticalStrut(5), BorderLayout.NORTH);
    JPanel buttonPanel = new JPanel(new GridLayout(buttonAction.length, 1, 2, 2));
    eastPanel.add(buttonPanel, BorderLayout.CENTER);
    for (AbstractAction element : buttonAction) {
        buttonPanel.add(createButton(element));
    }
    JLabel imageLabel = new JLabel();
    imageLabel.setBorder(BorderFactory.createEmptyBorder(BUTTONSIZE - 5, 1, 0, 0));
    //imageLabel.setIcon(new ImageIcon(image));
    imageLabel.setIcon(new ImageIcon(new ImageIcon(imageURL).getImage().getScaledInstance(400, 315, Image.SCALE_SMOOTH)));
    imageLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    imageLabel.setVerticalAlignment(SwingConstants.NORTH);
    this.getContentPane().add(imageLabel, BorderLayout.CENTER);
    this.getContentPane().add(eastPanel, BorderLayout.EAST);
}
项目:xdman    文件:YoutubeGrabberDlg.java   
JPanel createP3() {
    p3 = new JPanel(new BorderLayout());
    model = new DefaultListModel();
    list = new JList(model);
    list.setCellRenderer(new YTListRenderer());
    p3.add(new JScrollPane(list));
    Box box = Box.createHorizontalBox();
    box.add(Box.createHorizontalGlue());
    btnDwnld = new JButton("Download");
    btnDwnld.addActionListener(this);
    btnCancel = new JButton("Close");
    btnCancel.addActionListener(this);
    box.add(btnDwnld);
    box.add(Box.createHorizontalStrut(10));
    box.add(btnCancel);
    btnCancel.setPreferredSize(btnDwnld.getPreferredSize());
    box.add(Box.createHorizontalStrut(10));
    box.add(Box.createRigidArea(new Dimension(0, 40)));
    p3.add(box, BorderLayout.SOUTH);

    box.setOpaque(true);
    box.setBackground(StaticResource.titleColor);
    return p3;
}
项目:Bachelor-Thesis    文件:SimMenuBar.java   
private void init() {
    JMenu pfMenu = new JMenu("Playfield graphics");
    JMenu help = new JMenu("Help");
    Settings settings = new Settings(UNDERLAY_NS);
    if (settings.contains("fileName")) {
        // create underlay image menu item only if filename is specified 
        enableBgImage = createCheckItem(pfMenu,"Show underlay image",false);
    }
    enableNodeName = createCheckItem(pfMenu, "Show node name string",true);
    enableNodeCoverage = createCheckItem(pfMenu, 
            "Show node radio coverage", true);
    enableNodeConnections = createCheckItem(pfMenu,
            "Show node's connections", true);
    enableMapGraphic = createCheckItem(pfMenu,"Show map graphic",true);
    autoClearOverlay = createCheckItem(pfMenu, "Autoclear overlay",true);
    clearOverlay = createMenuItem(pfMenu,"Clear overlays now");
    about = createMenuItem(help,"about");
    this.add(pfMenu);
    this.add(Box.createHorizontalGlue());
    this.add(help);
}
项目:JavaGraph    文件:Template.java   
public TemplateEditor(GrammarModel grammar) {
    super(grammar, new SpringLayout());
    setBackground(ExplorationDialog.INFO_BG_COLOR);
    addName();
    addExplanation();
    add(Box.createRigidArea(new Dimension(0, 6)));
    addKeyword();
    addNrArguments();
    add(Box.createRigidArea(new Dimension(0, 6)));
    for (String argName : Template.this.argumentNames) {
        addArgument(argName);
    }
    SpringUtilities.makeCompactGrid(this,
        6 + Template.this.argumentNames.length,
        1,
        2,
        2,
        0,
        0);
    refresh();
}
项目:openjdk-jdk10    文件:bug8136998.java   
private void setupUI() {
    frame = new JFrame();
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

    comboBox = new JComboBox<>(ITEMS);

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

    scrollable.add(Box.createVerticalStrut(200));
    scrollable.add(comboBox);
    scrollable.add(Box.createVerticalStrut(200));

    scrollPane = new JScrollPane(scrollable);

    frame.add(scrollPane);

    frame.setSize(100, 200);
    frame.setVisible(true);
}
项目:QN-ACTR-Release    文件:StatsPanel.java   
private void createMatrixQQ() {
    Box mainBox = Box.createVerticalBox();
    Box descBox = Box.createHorizontalBox();
    Box tableBox = Box.createHorizontalBox();

    scatterQQPlot.add(mainBox);

    mainBox.add(Box.createVerticalStrut(10));
    mainBox.add(descBox);
    mainBox.add(Box.createVerticalStrut(10));
    mainBox.add(tableBox);
    mainBox.add(Box.createVerticalStrut(10));

    descBox.add(new JLabel(QQ_MATRIX_DESCRIPTION));
    qqMatrix = new DispQQPlotMatrix();
    tableBox.add(qqMatrix);
}
项目:OpenDA    文件:Query.java   
/** Specify a message to be displayed above the query.
 *  @param message The message to display.
 */
public void setMessage(String message) {
    if (!_messageScrollPaneAdded) {
        _messageScrollPaneAdded = true;
        add(_messageScrollPane, 1);

        // Add a spacer.
        add(Box.createRigidArea(new Dimension(0, 10)), 2);
    }

    _messageArea.setText(message);
    // I'm not sure why we need to add 1 here?
    int lineCount = _messageArea.getLineCount() + 1;
    // Keep the line count to less than 30 lines.  If
    // we have more than 30 lines, we get a scroll bar.
    if (lineCount > 30) {
        lineCount = 30;
    }
    _messageArea.setRows(lineCount);
    _messageArea.setColumns(_width);

    // In case size has changed.
    validate();
}
项目:jmt    文件:SynopsisPanel.java   
private void initComponents() {
    Box vBox = Box.createVerticalBox();
    Box hBox = Box.createHorizontalBox();
    synView = new JTextPane();
    synView.setContentType("text/html");
    synView.setEditable(false);
    synScroll = new JScrollPane(synView);
    synScroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    synScroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
    vBox.add(Box.createVerticalStrut(30));
    vBox.add(hBox);
    vBox.add(Box.createVerticalStrut(30));
    hBox.add(Box.createHorizontalStrut(20));
    hBox.add(synScroll);
    hBox.add(Box.createHorizontalStrut(20));
    this.setLayout(new GridLayout(1, 1));
    this.add(vBox);
}
项目:jtk    文件:LogAxisPlotDemo2.java   
public static JPanel makeScaleOptionPanel(){

  // create the side panel with scale change options
  JPanel optionPanel = new JPanel();
  optionPanel.add(Box.createVerticalStrut(20));
  optionPanel.setLayout(new BoxLayout(optionPanel,BoxLayout.Y_AXIS));
  optionPanel.add(makeScalePanel(pv1,"View (0,0)"));
  optionPanel.add(Box.createVerticalStrut(20));
  optionPanel.add(new Separator());
  optionPanel.add(makeScalePanel(pv2,"View (0,1)"));
  optionPanel.add(Box.createVerticalStrut(20));
  optionPanel.add(new Separator());
  optionPanel.add(makeScalePanel(pv3,"View (1,0)"));
  optionPanel.add(Box.createVerticalStrut(20));
  optionPanel.add(new Separator());
  optionPanel.add(makeScalePanel(pv4,"View (1,1)"));
  optionPanel.add(Box.createVerticalStrut(20));
  return optionPanel;
}
项目:openjdk-jdk10    文件:NimbusGlueTest.java   
private static void createUI() throws Exception {
    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            frame = new JFrame();
            bar = new JToolBar();
            bar.add(createButton(1));
            bar.add(createButton(2));
            bar.add(Box.createHorizontalGlue());
            bar.add(createButton(3));
            frame.add(bar, BorderLayout.NORTH);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(600, 400);
            frame.setVisible(true);
        }
    });
}
项目:jmt    文件:StatsPanel.java   
/**
 * Sets up univariate statistics panel
 */
private void createUnivariate() {
    Box mainBox = Box.createVerticalBox();
    Box centralBox = Box.createHorizontalBox();
    mainBox.add(Box.createVerticalStrut(10));
    mainBox.add(centralBox);
    mainBox.add(Box.createVerticalStrut(10));

    uniStatsPanel.add(mainBox);

    // Pannello dei componenti univariate statistics panel
    JPanel componentsPanel = new JPanel(new BorderLayout(0, 5));

    // Aggiuna label descrizione
    componentsPanel.add(new JLabel(UNIV_DESCRITPION), BorderLayout.NORTH);
    componentsPanel.add(transfGraphCreate(), BorderLayout.SOUTH);
    componentsPanel.add(getScrollPaneTable(), BorderLayout.CENTER);

    // Aggiuna pannello dei componenti al tabbed pane univariate
    centralBox.add(componentsPanel);
}
项目:jmt    文件:StatsPanel.java   
/**
 * Sets up bivariate statistics panel
 */
private void createBivariate() {
    Box mainBox = Box.createVerticalBox();
    Box centralBox = Box.createVerticalBox();
    mainBox.add(Box.createVerticalStrut(10));
    mainBox.add(centralBox);
    mainBox.add(Box.createVerticalStrut(10));

    bivStatsPanel.add(mainBox);
    JPanel mainPanel = new JPanel(new BorderLayout(0, 20));
    centralBox.add(mainPanel);
    mainPanel.add(new JLabel(BIVARIATE_DESCRIPTION), BorderLayout.NORTH);
    tableBivariate = new JWatBivariateStatsTable();
    modelBivariate = new JWatBivariateStatsTableModel(model.getMatrix());
    tableBivariate.setModel(modelBivariate);
    panelBiv = new ScrollBivariatePanel(tableBivariate);
    mainPanel.add(panelBiv, BorderLayout.CENTER);
}
项目:jmt    文件:JWatStartScreen.java   
private void initGUI() {
    this.setIconImage(JMTImageLoader.loadImage(IMG_JWATICON).getImage());
    this.setResizable(false);
    this.setTitle("JWAT");
    this.setSize(CommonConstants.MAX_GUI_WIDTH_JWAT_STARTSCREEN, CommonConstants.MAX_GUI_HEIGHT_JWAT_STARTSCREEN);
    //Image image = new ImageIcon(imageURL).getImage();
    //image = image.getScaledInstance(400, 315, Image.SCALE_SMOOTH);
    JPanel eastPanel = new JPanel(new BorderLayout());
    eastPanel.add(Box.createVerticalStrut(5), BorderLayout.NORTH);
    JPanel buttonPanel = new JPanel(new GridLayout(buttonAction.length, 1, 2, 2));
    eastPanel.add(buttonPanel, BorderLayout.CENTER);
    for (AbstractAction element : buttonAction) {
        buttonPanel.add(createButton(element));
    }
    JLabel imageLabel = new JLabel();
    imageLabel.setBorder(BorderFactory.createEmptyBorder(BUTTONSIZE - 5, 1, 0, 0));
    //imageLabel.setIcon(new ImageIcon(image));
    imageLabel.setIcon(new ImageIcon(new ImageIcon(imageURL).getImage().getScaledInstance(400, 315, Image.SCALE_SMOOTH)));
    imageLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    imageLabel.setVerticalAlignment(SwingConstants.NORTH);
    this.getContentPane().add(imageLabel, BorderLayout.CENTER);
    this.getContentPane().add(eastPanel, BorderLayout.EAST);
}
项目:jmt    文件:SectorsTextualPanel.java   
private void initComponents() {
    Box vBox = Box.createVerticalBox();
    Box hBox = Box.createHorizontalBox();
    synView = new JTextPane();
    synView.setContentType("text/html");
    synView.setEditable(false);
    synScroll = new JScrollPane(synView);
    synScroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    synScroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
    vBox.add(Box.createVerticalStrut(30));
    vBox.add(hBox);
    vBox.add(Box.createVerticalStrut(30));
    hBox.add(Box.createHorizontalStrut(20));
    hBox.add(synScroll);
    hBox.add(Box.createHorizontalStrut(20));
    this.setLayout(new GridLayout(1, 1));
    this.add(vBox);
    synView
            .setText("<html><body><center><font face=\"bold\" size=\"3\">Saturation Sectors will be here displayed once you solve the model.</font></center></body></html>");
}
项目:java-course    文件:LJStatusBar.java   
/**
 * Initializes status bar GUI.
 */
private void initGUI() {
    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));

    length = new JLabel(lp.getString("length") + ": 0");
    line = new JLabel(lp.getString("line") + ": 1");
    column = new JLabel(lp.getString("column") + ": 0");
    selection = new JLabel(lp.getString("length") + ": 0");
    time = new JLabel();

    add(length);
    add(Box.createHorizontalGlue());

    add(line);
    add(Box.createRigidArea(new Dimension(5, 0)));
    add(column);
    add(Box.createRigidArea(new Dimension(5, 0)));
    add(selection);
    add(Box.createHorizontalGlue());
    add(time);

    timer = new Timer(500, timerListener);
    timer.start();
}
项目:alevin-svn2    文件:SearchFieldDemo.java   
public SearchFieldDemo() {
    super("MuLaViTo SearchBar Demo");

    search = new AbstractSearchField() {
        @Override
        protected void search(Pattern pat) {
            List<Integer> find = new ArrayList<Integer>();
            for (int i = 0; i < list.getModel().getSize(); i++)
                if (pat.matcher(list.getModel().getElementAt(i).toString())
                        .find())
                    find.add(i);
            list.setSelectedIndices(toInt(find));
        }

        private int[] toInt(List<Integer> value) {
            int[] ret = new int[value.size()];
            for (int i = 0; i < value.size(); i++)
                ret[i] = value.get(i);
            return ret;
        }
    };

    JToolBar toolbar = new JToolBar();
    JButton btn = new JButton("About");
    btn.setActionCommand("about");
    btn.addActionListener(this);
    toolbar.add(btn);
    toolbar.add(Box.createHorizontalGlue());
    toolbar.add(search);
    getToolBarPane().add(toolbar);
}
项目:WL4Edit    文件:DataTester.java   
private void initializePanel(int lidx, int aidx) {
    this.setTitle(String.format("Area View: Level %02X, Area %02X", lidx, aidx));
    getContentPane().removeAll();
    JPanel panel = new TestPanel(levels[lidx].areas[aidx]);
    panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
    panel.add(Box.createRigidArea(new Dimension(levels[lidx].areas[aidx].width * 16 * SCALE,
            levels[lidx].areas[aidx].height * 16 * SCALE)));
    add(panel);
    pack();
}
项目:incubator-netbeans    文件:MultilinePanel.java   
/**
 * Creates a panel containing the specified title and text.
 * The title will be displayed as an emphasized (bold) first
 * line of text.
 *
 * @param  title  title of the dialog
 *                (if <CODE>null</CODE>, no title is displayed)
 * @param  text  text to be displayed
 */
public MultilinePanel(String title, String text) {
    super();
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    //
    if (title != null) {
        JLabel label = new JLabel(title);
        label.setFont(label.getFont().deriveFont(Font.BOLD));
        add(label);
    }
    //
    StringTokenizer tokenizer = new StringTokenizer(text, "\n", true);  //NOI18N
    boolean lastWasNewline = true;
    for (int i = 0; tokenizer.hasMoreTokens(); ++i) {
        String line = tokenizer.nextToken();
        if ("\n".equals(line)) {   //NOI18N
            if (!lastWasNewline) {
                lastWasNewline = true;
                continue;   //newline after text - end of line
            }
            //two adjacent newlines - empty line
            line = " ";  //empty JLabels have zero height    //NOI18N
        }
        else {
            lastWasNewline = false;
        }
        add(new JLabel(line));
    }
    add(Box.createVerticalGlue());
}
项目:jaer    文件:PotPanel.java   
/** builds the panel of pots */
    private void buildPanel() {
        IPotSliderTextControl.allInstances.clear();
        potList=new ArrayList<Pot>(pots.getPots());
        componentList=new ArrayList<JComponent>();
        Collections.sort(potList, new PotDisplayComparator());
        potsPanel=new JPanel();
        potsPanel.setAlignmentX(RIGHT_ALIGNMENT);
        potsPanel.getInsets().set(0, 0, 0, 0);
        potsPanel.setLayout(new BoxLayout(potsPanel, BoxLayout.Y_AXIS));
        scrollPane=new JScrollPane(potsPanel);
        add(new PotSorter(componentList, potList));
        add(scrollPane);
        for(Pot p : potList) {
            JComponent s=p.makeGUIPotControl(); // make a bias control gui component
            s.setAlignmentX(RIGHT_ALIGNMENT);
            potsPanel.add(s);
            componentList.add(s);
            addBorderSetter(s);
        }
        potsPanel.add(Box.createVerticalGlue());
//        JPanel fillPanel=new JPanel();
//        fillPanel.setMinimumSize(new Dimension(0, 0));
//        fillPanel.setPreferredSize(new Dimension(0, 0));
//        fillPanel.setMaximumSize(new Dimension(32767, 32767));
//        potsPanel.add(fillPanel); // spacer at bottom so biases don't stretch out too much
    }
项目:incubator-netbeans    文件:JSEDeploymentPanel.java   
private void addPanelFiller(int gridY) {
    java.awt.GridBagConstraints constraints = new java.awt.GridBagConstraints();
    constraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    constraints.gridx = 0;
    constraints.gridy = gridY;
    //constraints.weightx = 1.0;
    constraints.weighty = 1.0;
    extPanel.add( new Box.Filler(
            new Dimension(), 
            new Dimension(),
            new Dimension(10000,10000) ),
            constraints);
}
项目:Equella    文件:GResourceSelector.java   
@Override
public JComponent generateControl()
{
    field = new JTextField();
    field.setMaximumSize(new Dimension(Short.MAX_VALUE, 20));

    if( items.size() >= 1 )
    {
        field.setText(((Item) items.get(0)).getValue());
    }

    JButton browse = new JButton("Browse");
    browse.setIcon(new ImageIcon(getClass().getResource("/images/browse.gif")));
    browse.setHorizontalTextPosition(SwingConstants.RIGHT);
    Dimension browseSize = browse.getPreferredSize();
    browseSize.height = 20;
    browse.setMaximumSize(browseSize);
    browse.addActionListener(this);

    JPanel group = new JPanel();
    group.setLayout(new BoxLayout(group, BoxLayout.X_AXIS));
    group.add(field);
    group.add(Box.createRigidArea(new Dimension(5, 0)));
    group.add(browse);
    group.setAlignmentX(Component.LEFT_ALIGNMENT);

    return group;
}
项目:Logisim    文件:Toolbar.java   
private void computeContents() {
    subpanel.removeAll();
    ToolbarModel m = model;
    if (m != null) {
        for (ToolbarItem item : m.getItems()) {
            subpanel.add(new ToolbarButton(this, item));
        }
        subpanel.add(Box.createGlue());
    }
    revalidate();
}
项目:EditCalculateAndChart    文件:Find_Action.java   
public void actionPerformed(ActionEvent e) {
            JTextArea area = TEdit.getTextArea();
        if(!area.requestFocusInWindow()){
                    JOptionPane.showMessageDialog(TEdit.getFrame(),"Mouse click where to start search");
                    return;
          }


           JButton left = new JButton(FindLeft), right = new JButton(FindRight);
                   left.setBorderPainted(false); right.setBorderPainted(false);
            left.setText(null); right.setText(null);
            JPanel myPanel = new JPanel();
                myPanel.add(left);
                myPanel.add(Box.createHorizontalStrut(15)); // a spacer
                myPanel.add(right);

                lookingFor.setText(TEdit.getLookingFor());
                Object[] message = {
                 "", lookingFor,
                 "", myPanel
                };

             int option = JOptionPane.showConfirmDialog(TEdit.getFrame(), message, "Find Dialog", JOptionPane.OK_CANCEL_OPTION,JOptionPane.PLAIN_MESSAGE,myIcon);
                   if (option != JOptionPane.OK_OPTION){
                            TEdit.setLookingFor("");
                            return;
                   }
               TEdit.setLookingFor(lookingFor.getText());
}
项目:VASSAL-src    文件:BasicPiece.java   
private void initComponents(BasicPiece p) {
  panel = new JPanel();
  panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
  picker = new ImagePicker();
  picker.setImageName(p.imageName);
  panel.add(picker);
  cloneKeyInput = new KeySpecifier(p.cloneKey);
  deleteKeyInput = new KeySpecifier(p.deleteKey);
  pieceName = new JTextField(12);
  pieceName.setText(p.commonName);
  pieceName.setMaximumSize(pieceName.getPreferredSize());
  Box col = Box.createVerticalBox();
  Box row = Box.createHorizontalBox();
  row.add(new JLabel("Name:  "));
  row.add(pieceName);
  col.add(row);
  if (p.cloneKey != 0) {
    row = Box.createHorizontalBox();
    row.add(new JLabel("To Clone:  "));
    row.add(cloneKeyInput);
    col.add(row);
  }
  if (p.deleteKey != 0) {
    row = Box.createHorizontalBox();
    row.add(new JLabel("To Delete:  "));
    row.add(deleteKeyInput);
    col.add(row);
  }
  panel.add(col);
}
项目:xdman    文件:ConfigDialog.java   
Box createExceptionsPanel() {
    Box box = Box.createVerticalBox();
    box.setOpaque(false);
    box.setBorder(new EmptyBorder(10, 0, 0, 10));

    Box b0 = Box.createHorizontalBox();
    b0.add(new JLabel(getString("LBL_EXCEPT")));
    b0.setBorder(new EmptyBorder(0, 0, 10, 0));
    b0.add(Box.createHorizontalGlue());
    box.add(b0);

    txtException = new JTextArea();
    txtException.setLineWrap(false);
    txtException.setWrapStyleWord(true);

    JScrollPane jsp = new JScrollPane(txtException);
    jsp.setPreferredSize(new Dimension(10, 10));

    box.add(jsp);

    Box b = Box.createHorizontalBox();
    b.add(new JLabel(getString("LBL_EXCEPT_LN")));
    b.add(Box.createHorizontalGlue());
    b.setBorder(new EmptyBorder(5, 0, 5, 0));
    box.add(b);

    return box;
}
项目:VASSAL-src    文件:ValidationReportDialog.java   
public ValidationReportDialog(ValidationReport report, CallBack cb) {
  super(GameModule.getGameModule().getFrame(), false);
  setTitle("Problems found in module");
  this.callback = cb;
  Box reportBox = Box.createVerticalBox();
  add(reportBox);
  JPanel buttonPanel = new JPanel();
  add(buttonPanel, BorderLayout.SOUTH);

  final List<String> warnings = report.getWarnings();
  switch (warnings.size()) {
  case 0:
    reportBox.add(new JLabel("No problems found"));
    buttonPanel.add(createOkButton());
    break;
  case 1:
    reportBox.add(new JLabel("A problem was found in this module."));
    reportBox.add(new JLabel(warnings.get(0) + "."));
    buttonPanel.add(createOkButton());
    buttonPanel.add(createCancelButton());
    break;
  default:
    reportBox.add(new JLabel("The following problems were found in this module."));
    reportBox.add(new JLabel("If not fixed, they could cause bugs during game play."));
    JList list = new JList(warnings.toArray());
    list.setVisibleRowCount(Math.min(list.getVisibleRowCount(),warnings.size()));
    reportBox.add(new ScrollPane(list));
    buttonPanel.add(createOkButton());
    buttonPanel.add(createCancelButton());
  }

  pack();
  setLocationRelativeTo(null);
}
项目:MaxSim    文件:FlagsEditorPanel.java   
/** Creates a new instance of FlagsEditorPanel */
public FlagsEditorPanel(String flagString) {
    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));

    listModel = new FlagListModel(flagString);
    list = new JList(listModel);
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    list.addListSelectionListener(this);
    add(new JScrollPane(list));

    add(Box.createHorizontalStrut(3));

    Box buttonBox = new Box(BoxLayout.Y_AXIS);
    buttonBox.add(colorButton = new ColorChooserButton());
    buttonBox.add(newButton = new JButton("New..."));
    buttonBox.add(removeButton = new JButton("Remove"));
    buttonBox.add(upButton = new JButton("Up"));
    buttonBox.add(downButton = new JButton("Down"));
    buttonBox.add(Box.createVerticalGlue());
    add(buttonBox);
    layoutButtonContainer(buttonBox);

    colorButton.setColorChooserEnabled(false);
    colorButton.addActionListener(this);
    newButton.addActionListener(this);
    removeButton.addActionListener(this);
    upButton.addActionListener(this);
    downButton.addActionListener(this);

    selectionChanged(-1); // no selection
}
项目:incubator-netbeans    文件:EmptyTestStepLocation.java   
private Component createVisualComp() {
    JCheckBox[] chkBoxes;

    JComponent optCode = GuiUtils.createChkBoxGroup(
            NbBundle.getMessage(
                    GuiUtils.class,
                    "CommonTestsCfgOfCreate.groupOptCode"),               //NOI18N
            chkBoxes = GuiUtils.createCheckBoxes(new String[] {
                    GuiUtils.CHK_SETUP,
                    GuiUtils.CHK_TEARDOWN,
                    GuiUtils.CHK_BEFORE_CLASS,
                    GuiUtils.CHK_AFTER_CLASS}));
    chkSetUp = chkBoxes[0];
    chkTearDown = chkBoxes[1];
    chkBeforeClass = chkBoxes[2];
    chkAfterClass = chkBoxes[3];

    JComponent optComments = GuiUtils.createChkBoxGroup(
            NbBundle.getMessage(
                    GuiUtils.class,
                    "CommonTestsCfgOfCreate.groupOptComments"),           //NOI18N
            chkBoxes = GuiUtils.createCheckBoxes(new String[] {
                    GuiUtils.CHK_HINTS}));
    chkCodeHints = chkBoxes[0];

    JComponent box = new SelfResizingPanel();
    box.setLayout(new BoxLayout(box, BoxLayout.X_AXIS));
    box.add(optCode);
    box.add(Box.createHorizontalStrut(18));
    box.add(optComments);

    /* tune layout of the components within the box: */
    optCode.setAlignmentY(0.0f);
    optComments.setAlignmentY(0.0f);

    return box;
}
项目:JavaGraph    文件:CheckBoxEditor.java   
/**
 * Creates a button editor for a given explore key.
 */
public CheckBoxEditor(ExploreConfigDialog dialog, ExploreKey key, String title) {
    this.dialog = dialog;
    this.key = key;
    setBorder(BorderFactory.createTitledBorder(title));
    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
    add(createCheckBoxPanel());
    add(Box.createGlue());
    setMaximumSize(new Dimension(getMaximumSize().width, getPreferredSize().height));
    dialog.addRefreshable(this);
}
项目:incubator-netbeans    文件:CommitPanel.java   
private Component makeHorizontalStrut(JComponent compA,
                                      JComponent compB,
                                      LayoutStyle.ComponentPlacement relatedUnrelated) {
    int width = LayoutStyle.getInstance().getPreferredGap(
                        compA,
                        compB,
                        relatedUnrelated,
                        WEST,
                        this);
    return Box.createHorizontalStrut(width);
}
项目:incubator-netbeans    文件:CommitPanel.java   
private Component makeFlexibleHorizontalStrut(int minWidth,
                                              int prefWidth,
                                              int maxWidth) {
    return new Box.Filler(new Dimension(minWidth,  0),
                          new Dimension(prefWidth, 0),
                          new Dimension(maxWidth,  0));
}
项目:QN-ACTR-Release    文件:ServiceTimesPanel.java   
/**
 * Set up the panel contents and layout
 */
private void initComponents() {

    stTable = new STTable();

    Box hBox = Box.createHorizontalBox();
    hBox.add(Box.createHorizontalStrut(20));
    //Horizontal box containing Description label and buttons
    Box descrBox = Box.createVerticalBox();
    descrBox.add(new JLabel(DESCRIPTION_SERVICETIMES));
    descrBox.add(Box.createHorizontalStrut(10));
    descrBox.add(new JButton(SWITCH_TO_SD));
    descrBox.setPreferredSize(new Dimension(220, 1000));
    descrBox.setMinimumSize(new Dimension(200, 200));

    hBox.add(descrBox);
    hBox.add(Box.createHorizontalStrut(10));
    JScrollPane visitTablePane = new JScrollPane(stTable);
    visitTablePane.setPreferredSize(new Dimension(1000, 1000));
    visitTablePane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
    visitTablePane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    hBox.add(visitTablePane);
    hBox.add(Box.createHorizontalStrut(20));

    Box totalBox = Box.createVerticalBox();
    totalBox.add(Box.createVerticalStrut(20));
    totalBox.add(hBox);
    totalBox.add(Box.createVerticalStrut(20));

    setLayout(new BorderLayout());
    add(totalBox, BorderLayout.CENTER);

}
项目:VASSAL-src    文件:DynamicProperty.java   
public Ed(final DynamicProperty m) {
  keyCommandListConfig = new ListConfigurer(null, "Key Commands") {
    protected Configurer buildChildConfigurer() {
      return new DynamicKeyCommandConfigurer(m);
    }
  };
  keyCommandListConfig.setValue(
    new ArrayList<DynamicKeyCommand>(Arrays.asList(m.keyCommands)));
  PropertyChangeListener l = new PropertyChangeListener() {
    public void propertyChange(PropertyChangeEvent evt) {
      boolean isNumeric = numericConfig.booleanValue().booleanValue();
      minConfig.getControls().setVisible(isNumeric);
      maxConfig.getControls().setVisible(isNumeric);
      wrapConfig.getControls().setVisible(isNumeric);
      keyCommandListConfig.repack();
    }
  };
  controls = Box.createVerticalBox();
  nameConfig = new StringConfigurer(null, "Name:  ", m.getKey());
  controls.add(nameConfig.getControls());
  initialValueConfig = new StringConfigurer(null, "Value:  ", m.getValue());
  controls.add(initialValueConfig.getControls());
  numericConfig =
    new BooleanConfigurer(null, "Is numeric:  ", m.isNumeric());
  controls.add(numericConfig.getControls());
  minConfig =
    new IntConfigurer(null, "Minimum value:  ", m.getMinimumValue());
  controls.add(minConfig.getControls());
  maxConfig =
    new IntConfigurer(null, "Maximum value:  ", m.getMaximumValue());
  controls.add(maxConfig.getControls());
  wrapConfig = new BooleanConfigurer(null, "Wrap?", m.isWrap());
  controls.add(wrapConfig.getControls());
  controls.add(keyCommandListConfig.getControls());

  numericConfig.addPropertyChangeListener(l);
  numericConfig.fireUpdate();
}