Java 类java.awt.GridLayout 实例源码

项目:jaer    文件:JAERDataViewer.java   
/** Creates new form JAERDataViewer */
public JAERDataViewer(String title) {
    initComponents();

    this.setTitle(title);

    pnlGraph = new GraphPanel();
    pnlGraph.setBackground(new java.awt.Color(255, 255, 255));
    pnlGraph.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
    pnlGraphContainer.setLayout(new GridLayout(0,1));
    pnlGraph.setUpdateEvent(new GraphPanelUpdateEvent() {
        public void update() {
            updateAxeBoxes();
        }
    });
    pnlGraphContainer.add(pnlGraph);
    pnlGraphContainer.revalidate();
    pnlGraphContainer.repaint();

    pnlGraph.setResizeX(false);
    pnlGraph.setResizeY(true);
    updateAxeBoxes();
    periodicUpdate(true);
    tblData.setModel(tabledata);
}
项目:human-mobility-modeling-utilities    文件:FirstPassageTimeTest.java   
public FirstPassageTimeTest(){
    super(new GridLayout(1,2));
    int dbscanMeter = 500;
    loadRealWorldData(new DistanceWithUnit(dbscanMeter, SpatialDistanceUnit.Meter));
    HashMap<Long, Double> values = null;
    values = firstPassageTimeCalculationTest();

    double[][] plotValues = new double [values.keySet().size()][2];

    int index=0;

    for(Entry<Long, Double> entry:values.entrySet()){
        plotValues[index][0] = entry.getKey();
        plotValues[index][1] = entry.getValue();

        index++;
    }


    PlotCanvas canvas = LinePlot.plot("First passage time", plotValues, Line.Style.SOLID, Color.RED);
       canvas.setTitle("First passage time (DBSCAN=" + dbscanMeter + "m)");
       canvas.setAxisLabels("t (hour)", "Fpt (t)");

    add(canvas);

}
项目:sbc-qsystem    文件:FInfoDialog.java   
/**
 * Creates new form FStandAdvance
 */
public FInfoDialog(java.awt.Frame parent, boolean modal) {
    super(parent, modal);
    infoDialog = this;
    initComponents();
    if (WelcomeParams.getInstance().btnFont != null) {
        buttonBack.setFont(WelcomeParams.getInstance().btnFont);
        buttonInRoot.setFont(WelcomeParams.getInstance().btnFont);
        buttonPrint.setFont(WelcomeParams.getInstance().btnFont);
        jButton2.setFont(WelcomeParams.getInstance().btnFont);
    }

    //На верхней панели пункта регистрации, там где заголовок и картинка в углу, можно вывести вэб-контент по URL. Оставьте пустым если не требуется
    if (!WelcomeParams.getInstance().topURL.isEmpty()) {
        panelUp.removeAll();
        final BrowserFX bro = new BrowserFX();
        final GridLayout gl = new GridLayout(1, 1);
        panelUp.setLayout(gl);
        panelUp.add(bro);
        bro.load(Uses.prepareAbsolutPathForImg(WelcomeParams.getInstance().topURL));
    }
}
项目:sbc-qsystem    文件:BrowserFX.java   
public BrowserFX() {
    javafxPanel = new JFXPanel();
    GridLayout gl = new GridLayout(1, 1);
    setLayout(gl);
    add(javafxPanel, BorderLayout.CENTER);
    try {
        Thread.sleep(3000);
    } catch (InterruptedException ex) {
    }

    Platform.runLater(() -> {
        bro = new Browser();
        bro.getWebEngine().setJavaScriptEnabled(true);
        Scene scene = new Scene(bro, 750, 500, Color.web("#666970"));
        javafxPanel.setScene(scene);
        ready = true;
    });
}
项目:geomapapp    文件:GMAProfile.java   
void initSave() {
    savePanel = new JPanel(new GridLayout(0,1));
    savePanel.setBorder( BorderFactory.createTitledBorder("Save Options"));
    ButtonGroup gp = new ButtonGroup();
    saveToFile = new JToggleButton("Save ASCII table");
    savePanel.add( saveToFile );
    gp.add( saveToFile );
    saveToClipboard = new JToggleButton("Copy to clipboard");
    savePanel.add( saveToClipboard );
    gp.add( saveToClipboard );
    saveJPEG = new JToggleButton("Save JPEG image");
    savePanel.add( saveJPEG );
    gp.add( saveJPEG );
    savePNG = new JToggleButton("Save PNG image");
    savePanel.add( savePNG );
    gp.add( savePNG );
    print = new JToggleButton("Print");
    savePanel.add( print );
    gp.add( print );
}
项目:ramus    文件:SectorNameEditor.java   
private Component getReplacemetPanel() {
    JPanel group = new JPanel(new GridLayout(0, 1));
    group.setBorder(BorderFactory.createTitledBorder(ResourceLoader
            .getString("ArrowReplacementType.name")));
    group.add(safe = new JRadioButton("ArrowReplacementType.safe"));
    group.add(children = new JRadioButton("ArrowReplacementType.branching"));
    group.add(all = new JRadioButton("ArrowReplacementType.everywhere"));
    safe.setSelected(true);

    ButtonGroup g = new ButtonGroup();
    g.add(children);
    g.add(all);
    g.add(safe);

    setReplaceEnable(false);

    return group;
}
项目:incubator-netbeans    文件:FilesModifiedConfirmation.java   
public FilesModifiedConfirmation(SaveCookie[] saveCookies) {
    btnSaveAll = createSaveAllButton();
    btnSave    = createSaveButton();

    Mnemonics.setLocalizedText(btnSaveAll, getInitialSaveAllButtonText());
    Mnemonics.setLocalizedText(btnSave,    getInitialSaveButtonText());

    JScrollPane scrollPane
            = new JScrollPane(list = createFilesList(saveCookies));

    if (!listModel.isEmpty()) {
        list.setSelectedIndex(0);
    } else {
        updateSaveButtonState();
    }

    JComponent panel = new JPanel(new GridLayout(1, 1));
    panel.add(scrollPane);
    panel.setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12));
    mainComponent = panel;
}
项目:ramus    文件:StatusPanel.java   
/**
 * This method initializes this
 *
 * @return void
 */
private void initialize() {
    double[][] size = {{5, TableLayout.FILL, 5},
            {5, TableLayout.FILL, 5}};
    this.setLayout(new TableLayout(size));
    final GridLayout gridLayout3 = new GridLayout();
    JPanel child = new JPanel(gridLayout3);
    this.setSize(351, 105);
    gridLayout3.setRows(3);
    gridLayout3.setColumns(2);
    gridLayout3.setHgap(5);
    gridLayout3.setVgap(5);
    child.add(getJRadioButton(), null);
    child.add(getJRadioButton1(), null);
    child.add(getJRadioButton2(), null);
    child.add(getJRadioButton3(), null);
    child.add(getJRadioButton4(), null);
    child.add(getJTextField(), null);
    this.add(child, "1,1");
}
项目:ramus    文件:VisualPanelCopyOptions.java   
/**
 * Create the panel.
 */
public VisualPanelCopyOptions() {
    setLayout(new GridLayout(0, 1, 0, 0));

    copyFont = new JCheckBox("Visual.copyFont");
    copyFont.setSelected(true);
    add(copyFont);

    copyBackground = new JCheckBox("Visual.copyBackground");
    copyBackground.setSelected(true);
    add(copyBackground);

    copyForeground = new JCheckBox("Visual.copyForeground");
    copyForeground.setSelected(true);
    add(copyForeground);

    copySize = new JCheckBox("Visual.copySize");
    copySize.setSelected(true);
    add(copySize);

}
项目:rapidminer    文件:ProcessExecutionResultOverview.java   
/**
 * Removes and adds the single result blocks according to the current width.
 */
private void redoLayout() {
    resultPanel.removeAll();
    if (expanded) {
        int curWidth = parent.getSize().width;
        int relevantWidth = SingleResultOverview.MIN_WIDTH + 25;
        int xCount = curWidth / relevantWidth;
        int yCount = (int) Math.ceil((double) results.size() / xCount);
        resultPanel.setLayout(new GridLayout(yCount, xCount));
        for (SingleResultOverview overview : results) {
            resultPanel.add(overview);
        }
    }
    revalidate();

}
项目:bhattiprolu-pad    文件:BhattiproluPad.java   
public BhattiproluPad() {
    mainFrame = new JFrame("Bhattiprolu Pad - Now, type in Telugu easily");
    mainFrame.setSize(800, 800);
    mainFrame.setLayout(new GridLayout(3, 1));

    headLabel = new JLabel("Bhattiprolu Pad 0.1", JLabel.CENTER);
    contentLabel = new JLabel("Empty", JLabel.CENTER);
    mainPanel = new JPanel();
    mainPanel.setLayout(new FlowLayout());

    headLabel.setFont(englishFont);
    contentLabel.setFont(teluguFont);

    mainFrame.add(headLabel);
    mainFrame.add(mainPanel);
    mainFrame.add(contentLabel);
    mainFrame.setVisible(true);
    mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

}
项目: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);
}
项目:geomapapp    文件:XYSave.java   
void initSave() {
    savePanel = new JPanel(new GridLayout(0,1));
    savePanel.setBorder( BorderFactory.createTitledBorder("Save Options"));
    ButtonGroup gp = new ButtonGroup();
    saveToFile = new JToggleButton("Save ASCII table");
    savePanel.add( saveToFile );
    gp.add( saveToFile );
    saveToClipboard = new JToggleButton("Copy to clipboard");
    savePanel.add( saveToClipboard );
    gp.add( saveToClipboard );
    saveJPEG = new JToggleButton("Save JPEG image");
    savePanel.add( saveJPEG );
    gp.add( saveJPEG );
    savePNG = new JToggleButton("Save PNG image");
    savePanel.add( savePNG );
    gp.add( savePNG );
    saveToExcel = new JToggleButton("Save Excel table");
    savePanel.add( saveToExcel );
    gp.add( saveToExcel );
    print = new JToggleButton("Print");
    savePanel.add( print );
    gp.add( print );
}
项目:Equella    文件:AbstractTreeEditor.java   
public AbstractTreeEditor()
{
    tree = createTree();
    tree.addTreeSelectionListener(this);
    tree.setPreferredSize(new Dimension(325, 0));
    tree.setMinimumSize(new Dimension(325, 0));

    // Ensure the root nodes start loading
    tree.loadChildren(tree.getRootNode());

    editArea = new JPanel(new GridLayout(1, 1));

    AppletGuiUtils.removeBordersFromSplitPane(this);
    setOrientation(JSplitPane.HORIZONTAL_SPLIT);
    setContinuousLayout(true);
    setResizeWeight(0.05);

    add(tree, JSplitPane.LEFT);
    add(editArea, JSplitPane.RIGHT);

    noSelectionEditor = new BasicMessageEditor(
        CurrentLocale.get("com.tle.admin.gui.common.tree.nodeeditor.nonodeselected"));

    showTreeNodeEditor(noSelectionEditor);
}
项目: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>");
}
项目:Equella    文件:AdminToolList.java   
protected JPanel createButtonsPanel()
{
    List<JButton> buttons = createButtons();

    int count = buttons.size();
    int maxPerRow = 3;

    int cols = count < maxPerRow ? count : maxPerRow;
    int rows = (int) Math.ceil((double) count / (double) maxPerRow);

    JPanel content = new JPanel(new GridLayout(rows, cols));
    for( JButton button : buttons )
    {
        content.add(button);
    }

    return content;
}
项目:Sunrin2017    文件:Swing03.java   
public Swing03() {
    setTitle("GridLayout");
    setSize(200, 200);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    Container c = getContentPane();
    c.setLayout(new GridLayout(3, 2));
    c.add(new JButton("Btn1"));
    c.add(new JButton("Btn2"));
    c.add(new JButton("Btn3"));
    c.add(new JButton("Btn4"));
    c.add(new JButton("Btn5"));
    c.add(new JButton("Btn6"));

    setVisible(true);
}
项目:NovelJ    文件:SettingsWindow_Windows.java   
/**
 * Initialize the contents of the frame.
 */
private void initialize() {
    frame = new JFrame();
    frame.setBounds(100, 100, 450, 300);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout(new GridLayout(1, 0, 0, 0));

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    frame.getContentPane().add(tabbedPane);

    JScrollPane scrollPane = new JScrollPane();
    tabbedPane.addTab("New tab", null, scrollPane, null);

    JScrollPane scrollPane_1 = new JScrollPane();
    tabbedPane.addTab("New tab", null, scrollPane_1, null);
}
项目:QN-ACTR-Release    文件:KMeanScatterPanelChoose.java   
public KMeanScatterPanelChoose(WorkloadAnalysisSession m) {
    super(new BorderLayout());
    setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED), "Scatter Clustering"));

    model = (ModelWorkloadAnalysis) m.getDataModel();
    this.session = m;

    varXCombo = new JComboBox(model.getMatrix().getVariableNames());
    varYCombo = new JComboBox(model.getMatrix().getVariableNames());
    varXCombo.setSelectedIndex(0);
    varYCombo.setSelectedIndex(1);

    JButton vis = new JButton(VIS_SCATTER);

    JPanel combos = new JPanel(new GridLayout(1, 2, 5, 0));
    combos.add(varXCombo);
    combos.add(varYCombo);

    add(combos, BorderLayout.NORTH);
    add(vis, BorderLayout.SOUTH);
}
项目:trashjam2017    文件:AppletGameContainer.java   
/**
 * Create a new panel to display the console output
 * 
 * @param e The exception causing the console to be displayed
 */
public ConsolePanel(Exception e) {
   setLayout(new BorderLayout());
   setBackground(Color.black);
   setForeground(Color.white);

   Font consoleFont = new Font("Arial", Font.BOLD, 14);

   Label slickLabel = new Label("SLICK CONSOLE", Label.CENTER);
   slickLabel.setFont(consoleFont);
   add(slickLabel, BorderLayout.PAGE_START);

   StringWriter sw = new StringWriter();
   e.printStackTrace(new PrintWriter(sw));

   textArea.setText(sw.toString());
   textArea.setEditable(false);
   add(textArea, BorderLayout.CENTER);

   // add a border on both sides of the console
   add(new Panel(), BorderLayout.LINE_START);
   add(new Panel(), BorderLayout.LINE_END);

   Panel bottomPanel = new Panel();
   bottomPanel.setLayout(new GridLayout(0, 1));
   Label infoLabel1 = new Label("An error occured while running the applet.", Label.CENTER);
   Label infoLabel2 = new Label("Plese contact support to resolve this issue.", Label.CENTER);
   infoLabel1.setFont(consoleFont);
   infoLabel2.setFont(consoleFont);
   bottomPanel.add(infoLabel1);
   bottomPanel.add(infoLabel2);
   add(bottomPanel, BorderLayout.PAGE_END);
}
项目:JAddOn    文件:JLogin.java   
public JLogin(Component c) {
    StaticStandard.setLogin(this);
    dialog.setModal(true);
    dialog.setPreferredSize(new Dimension(400, 150));
    setStandardNames();
    setStandardActionListeners();
    //input_panel.setLayout(new BoxLayout(input_panel, BoxLayout.Y_AXIS));
    input_panel.setLayout(new GridLayout(2, 2));
    pw_panel.setLayout(new BoxLayout(pw_panel, BoxLayout.X_AXIS));
    user_panel.setLayout(new BoxLayout(user_panel, BoxLayout.X_AXIS));

    /*
    pw_panel.add(pw_label);
    pw_panel.add(pw);
    user_panel.add(user_label);
    user_panel.add(user);
    */

    input_panel.add(user_label);
    input_panel.add(user);
    input_panel.add(pw_label);
    input_panel.add(pw);

    dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    dialog.setLayout(new BorderLayout());

    button_panel.add(login);
    button_panel.add(cancel);

    //input_panel.add(user_panel);
    //input_panel.add(pw_panel);
    dialog.add(input_panel, BorderLayout.CENTER);
    dialog.add(button_panel, BorderLayout.SOUTH);
    dialog.pack();
    setRelativeTo(c);
}
项目:litiengine    文件:AssetPanel.java   
public AssetPanel() {
  this.gridLayout = new GridLayout(3, COLUMNS);
  this.gridLayout.setVgap(5);
  this.gridLayout.setHgap(5);
  this.setLayout(this.gridLayout);

  this.setBorder(new EmptyBorder(5, 5, 5, 5));
  this.setBackground(Color.DARK_GRAY);
}
项目:geomapapp    文件:ShapeSuite.java   
public String getURLString() {
    JTextField txt = new JTextField(60);
    JPanel panel = new JPanel(new GridLayout(2,0));
    panel.add(new JLabel("Enter URL (example: \"http://www.ldeo.columbia.edu/~akm/shape_files/WF2004_T741.shp\")"));
    panel.add(txt);
    int ok = JOptionPane.showConfirmDialog((JFrame)map.getTopLevelAncestor(),
                panel,
                "enter URL",
                JOptionPane.OK_CANCEL_OPTION);
    if( ok==JOptionPane.CANCEL_OPTION) return null;
    return txt.getText();
}
项目:smile_1.5.0_java7    文件:IsoMapDemo.java   
@Override
public JComponent learn() {
    JPanel pane = new JPanel(new GridLayout(1, 2));
    double[][] data = dataset[datasetIndex].toArray(new double[dataset[datasetIndex].size()][]);        
    if (data.length > 1000) {
        double[][] x = new double[1000][];
        for (int i = 0; i < 1000; i++)
            x[i] = data[i];
        data = x;
    }

    long clock = System.currentTimeMillis();
    IsoMap isomap = new IsoMap(data, 2, k);
    System.out.format("Learn IsoMap from %d samples in %dms\n", data.length, System.currentTimeMillis() - clock);

    double[][] y = isomap.getCoordinates();

    PlotCanvas plot = new PlotCanvas(Math.colMin(y), Math.colMax(y));
    plot.points(y, 'o', Color.RED);

    int n = y.length;
    Graph graph = isomap.getNearestNeighborGraph();
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < i; j++) {
            if (graph.hasEdge(i, j)) {
                plot.line(y[i], y[j]);
            }
        }
    }

    plot.setTitle("IsoMap");
    pane.add(plot);

    return pane;
}
项目:GIFKR    文件:SaveFrame.java   
public SaveFrame(Animation animation, ProgressDisplay d) {
    super("Save");
    this.animation = animation;
    this.d = d;

    initializeComponents();
    addActionListeners();

    setLayout(new GridBagLayout());
    GridBagConstraints gbc = ViewUtils.createGBC();

    JPanel spinPanel = new JPanel(new GridLayout(3,2));
    spinPanel.add(new JLabel("Width:"));
    spinPanel.add(widthSpinner);
    spinPanel.add(new JLabel("Height:"));
    spinPanel.add(heightSpinner);
    spinPanel.add(frameDelayLabel);
    spinPanel.add(frameDelaySpinner);

    add(spinPanel, gbc);
    gbc.gridy++;


    JLabel noteLabel = new JLabel("Filename conflicts will be resolved automatically");
    noteLabel.setFont(noteLabel.getFont().deriveFont(noteLabel.getFont().getSize() - 2f));
    add(noteLabel, gbc);
    gbc.gridy++;

    add(chooser, gbc);
    pack();
}
项目:2D-Elliptic-Mesh-Generator    文件:DataSelectPanel.java   
public DataSelectPanel(Object[][] data, int dimension, String... parametersNames) {
    _data = data;
    _dimension = dimension;

    _parametersNames = parametersNames;

    if (_dimension > parametersNames.length) {
        throw new IllegalArgumentException("Number of parameters must be > to dimension=" + _dimension);
    }

    setLayout(new GridLayout(_parametersNames.length /*+ 1*/, 1));
    //JPanel title = new JPanel();
    //title.setLayout(new GridLayout(1, 2));
    //title.add(new JLabel("Variable"));
    //title.add(new JLabel("Axis / Parameter"));
    //add(title);

    if (_dimension == 0) {
        buildRows();
    } else if (_dimension == 1) {
        buildRows(0);
    } else if (_dimension == 2) {
        buildRows(0, 1);
    } else if (_dimension == 3) {
        buildRows(0, 1, 2);
    }

    fireSelectedDataChanged("init");
}
项目:Pixie    文件:UserConfigs.java   
/**
 * Add a list of radio buttons, representing default, generally used, values
 * for the DPI.
 */
private void addDPIDefaultVals() {
    // set the layout of the panel, based on the amount of elements to be displayed on it
    jPDefaultValues.setLayout(new GridLayout(DPI_VALUES.length, 1));

    for (int index = 0; index < DPI_VALUES.length; index++) {
        String text = DPI_VALUES[index] + " DPI";

        // create a radio button with the given text
        JRadioButton jrbDPIValues = new JRadioButton(text);

        // set its action command to a number for easier usage later (to retrieve the value of the DPI)
        jrbDPIValues.setActionCommand(Integer.toString(DPI_VALUES[index]));

        // add action listener to synchronize the text field with the radio buttons
        jrbDPIValues.addActionListener(e -> jFTFDPIValue.setValue(Integer.parseInt(bgScreenDPIs.getSelection().getActionCommand())));

        // add mouse listener to display the help message when the mouse is on top of the radio buttons
        jrbDPIValues.addMouseListener(new java.awt.event.MouseAdapter() {
            @Override
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jPDefaultValuesMouseEntered(evt);
            }
        });

        jrbDPIValues.setBackground(Color.white);

        // add the radio button to the button group
        bgScreenDPIs.add(jrbDPIValues);

        // add the radio button to the panel displaying it
        jPDefaultValues.add(jrbDPIValues);

        // select the radio button which has the same value as the user preffered one (if any)
        if (DPI_VALUES[index] == userPreferences.getPreferredDPI()) {
            jrbDPIValues.setSelected(true);
            jFTFDPIValue.setValue(DPI_VALUES[index]);
        }
    }
}
项目:smile_1.5.0_java7    文件:IsotonicMDSDemo.java   
/**
 * Execute the MDS algorithm and return a swing JComponent representing
 * the clusters.
 */
public JComponent learn() {
    JPanel pane = new JPanel(new GridLayout(1, 2));
    double[][] data = dataset[datasetIndex].toArray(new double[dataset[datasetIndex].size()][]);
    String[] labels = dataset[datasetIndex].toArray(new String[dataset[datasetIndex].size()]);
    if (labels[0] == null) {
        Attribute[] attr = dataset[datasetIndex].attributes();
        labels = new String[attr.length];
        for (int i = 0; i < labels.length; i++) {
            labels[i] = attr[i].getName();
        }
    }

    long clock = System.currentTimeMillis();
    IsotonicMDS isomds = new IsotonicMDS(data, 2);
    System.out.format("Learn Kruskal's Nonmetric MDS (k=2) from %d samples in %dms\n", data.length, System.currentTimeMillis()-clock);

    PlotCanvas plot = ScatterPlot.plot(isomds.getCoordinates(), labels);
    plot.setTitle("Kruskal's Nonmetric MDS (k = 2)");
    pane.add(plot);

    clock = System.currentTimeMillis();
    isomds = new IsotonicMDS(data, 3);
    System.out.format("Learn Kruskal's Nonmetric MDS (k=3) from %d samples in %dms\n", data.length, System.currentTimeMillis()-clock);

    plot = ScatterPlot.plot(isomds.getCoordinates(), labels);
    plot.setTitle("Kruskal's Nonmetric MDS (k = 3)");
    pane.add(plot);

    return pane;
}
项目:LivroJavaComoProgramar10Edicao    文件:TicTacToeClient.java   
public TicTacToeClient(String host)
{ 
   ticTacToeHost = host; // set name of server
   displayArea = new JTextArea(4, 30); // set up JTextArea
   displayArea.setEditable(false);
   add(new JScrollPane(displayArea), BorderLayout.SOUTH);

   boardPanel = new JPanel(); // set up panel for squares in board
   boardPanel.setLayout(new GridLayout(3, 3, 0, 0));

   board = new Square[3][3]; // create board

   // loop over the rows in the board
   for (int row = 0; row < board.length; row++) 
   {
      // loop over the columns in the board
      for (int column = 0; column < board[row].length; column++) 
      {
         // create square
         board[row][column] = new Square(" ", row * 3 + column);
         boardPanel.add(board[row][column]); // add square       
      }
   } 

   idField = new JTextField(); // set up textfield
   idField.setEditable(false);
   add(idField, BorderLayout.NORTH);

   panel2 = new JPanel(); // set up panel to contain boardPanel
   panel2.add(boardPanel, BorderLayout.CENTER); // add board panel
   add(panel2, BorderLayout.CENTER); // add container panel

   setSize(300, 225); // set size of window
   setVisible(true); // show window

   startClient();
}
项目:knime-activelearning    文件:ButtonList.java   
/**
 * Contructor with ClassModel Initializes ClassModel directly via the
 * constructor.
 *
 * @param classModel
 *            the ClassModel
 * @param maxRows
 *            maximum number of buttons per column
 */
public ButtonList(final ClassModel classModel, final int maxRows) {
    super();

    m_maxRows = maxRows;
    m_panels = new ArrayList<>();
    m_buttons = new ArrayList<>();

    m_classModel = classModel;

    setLayout(new GridLayout(1, 3));

    recreateButtonList();
}
项目:incubator-netbeans    文件:PopupPane.java   
public PopupPane() {
    listComponents = new HashSet<ListComponent>();
    view = new JPanel();
    GridLayout grid = new GridLayout(0, 1);
    grid.setHgap(0);
    grid.setVgap(0);
    view.setLayout(grid);
    view.setBorder(BorderFactory.createEmptyBorder());
    setName("progresspopup"); //NOI18N
    setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    setViewportView(view);
    setFocusable(true);
    setRequestFocusEnabled(true);

    Action down = new MoveDownAction();
    getActionMap().put("Move-Down", down);
    getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), "Move-Down");
    getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), "Move-Down");

    Action up = new MoveUpAction();
    getActionMap().put("Move-Up", up);
    getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), "Move-Up");
    getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), "Move-Up");
    Action cancel = new CancelAction();
    getActionMap().put("Cancel-Task", cancel);
    getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "Cancel-Task");
    getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "Cancel-Task");

    Action select = new SelectAction();
    getActionMap().put("select-task", select);
    getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0), "select-task");
    getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0), "select-task");


    setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
}
项目:openjdk-jdk10    文件:JSplitPaneOverlapping.java   
protected void prepareControls() {
    JFrame frame = new JFrame("SplitPane Mixing");
    JPanel p = new JPanel(new GridLayout());
    p.setPreferredSize(new Dimension(500, 500));
    propagateAWTControls(p);
    sp1 = new JScrollPane(p);

    JButton button = new JButton("JButton");
    button.setBackground(Color.RED);
    button.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            clicked = true;
        }
    });
    sp2 = new JScrollPane(button);

    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sp1, sp2);
    splitPane.setOneTouchExpandable(false);
    splitPane.setDividerLocation(150);

    splitPane.setPreferredSize(new Dimension(400, 200));

    frame.getContentPane().add(splitPane);
    frame.pack();
    frame.setVisible(true);
}
项目:ABM-adaptive-tolerance    文件:MigFrame.java   
public MigFrame(World world, EventManager event, int[] rules)
{
    super("MigScape 3.0");  // creates frame, the constructor uses a string argument for the frame title
    JPanel mainPanel = new JPanel(new GridLayout(5, 5));
    grid = new Grid(world, false);
    gridF = new Grid(world, true);
    ui = new UserControls(grid, event, rules);
    para = new Parameters(event, rules);

    mainPanel.add(grid, BorderLayout.CENTER);
    mainPanel.add(ui, BorderLayout.NORTH);
    mainPanel.add(para, BorderLayout.SOUTH);
    mainPanel.setSize(world.getSizeX()*10, world.getSizeY()*10);
    grid.setSize(new Dimension(world.getSizeX()*10, world.getSizeY()*10));
    gridF.setSize(new Dimension(world.getSizeX()*10, world.getSizeY()*10));
    ui.setSize(new Dimension(world.getSizeY()*10, 50));
    para.setSize(new Dimension(world.getSizeY()*10, 50));
    this.add(grid, BorderLayout.CENTER);
    this.add(gridF, BorderLayout.EAST);
    this.add(ui, BorderLayout.NORTH);
    this.add(para, BorderLayout.SOUTH);
    this.validate();
    setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);  // specifies what happens when user closes the frame. exit_on_close means the program will stop
    grid.setBackground(Color.WHITE);
    gridF.setBackground(Color.WHITE);
    ui.setBackground(Color.WHITE);
    para.setBackground(Color.WHITE);
}
项目:incubator-netbeans    文件:OpenFileAction.java   
@Override
public boolean approve(File[] selectedFiles) {
    /* check the files: */
    List<String> errorMsgs = null;
    for (int i = 0; i < selectedFiles.length; i++) {
        String msgPatternRef = null;
        File file = selectedFiles[i];

        if (!file.exists()) {
            msgPatternRef = "MSG_FileDoesNotExist";             //NOI18N
        } else if (file.isDirectory()) {
            msgPatternRef = "MSG_FileIsADirectory";             //NOI18N
        } else if (!file.isFile()) {
            msgPatternRef = "MSG_FileIsNotPlainFile";           //NOI18N
        }
        if (msgPatternRef == null) {
            continue;
        }
        if (errorMsgs == null) {
            errorMsgs = new ArrayList<String>(selectedFiles.length - i);
        }
        errorMsgs.add(NbBundle.getMessage(OpenFileAction.class,
                msgPatternRef, file.getName()));
    }
    if (errorMsgs == null) {
        return true;
    } else {
        JPanel panel = new JPanel(
                new GridLayout(errorMsgs.size(), 0, 0, 2));   //gaps
        for (String errMsg : errorMsgs) {
            panel.add(new JLabel(errMsg));
        }
        DialogDisplayer.getDefault().notify(
                new NotifyDescriptor.Message(
                panel, NotifyDescriptor.WARNING_MESSAGE));
        return false;
    }
}
项目:Equella    文件:NoTopicEditor.java   
public NoTopicEditor(String message)
{
    JLabel messageLabel = new JLabel(CurrentLocale.get(getKey("notopic.") + message));
    messageLabel.setHorizontalAlignment(SwingConstants.CENTER);

    setLayout(new GridLayout(1, 1));
    add(messageLabel);
}
项目:ants    文件:FoodView.java   
public FoodView() {
    setLayout(new GridLayout(3, 1, 5, 5));

    add(textID);
    add(textPositionX);
    add(textPositionY);
}
项目:rapidminer    文件:AverageVectorViewer.java   
public AverageVectorViewer(AverageVector vector, IOContainer container) {
    setLayout(new GridLayout(1, 1));
    this.vector = vector;

    JPanel mainPanel = new JPanel();
    GridBagLayout layout = new GridBagLayout();
    mainPanel.setLayout(layout);
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.BOTH;
    c.insets = new Insets(11, 11, 11, 11);
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.weightx = 1.0d;
    c.weighty = 0.0d;

    JLabel mainLabel = new JLabel("<html><h2>" + getName() + " (" + vector.size() + ")</h2></html>");
    layout.setConstraints(mainLabel, c);
    mainPanel.add(mainLabel);

    for (int i = 0; i < vector.size(); i++) {
        Averagable avg = vector.getAveragable(i);
        Component visualizationComponent = ResultDisplayTools.createVisualizationComponent(avg, container, "Averagable");
        layout.setConstraints(visualizationComponent, c);
        mainPanel.add(visualizationComponent);

    }
    ExtendedJScrollPane scrollPane = new ExtendedJScrollPane(mainPanel);
    scrollPane.setBorder(null);
    add(scrollPane);
}
项目:FreeCol    文件:NationTypeDetailPanel.java   
/**
 * Builds the details panel for the given nation type.
 *
 * @param nationType - the IndianNationType
 * @param panel the panel to use
 */
private void buildIndianNationTypeDetail(IndianNationType nationType,
                                         JPanel panel) {
    List<RandomChoice<UnitType>> skills = nationType.getSkills();

    panel.setLayout(new MigLayout("wrap 2, gapx 20", "", ""));

    JLabel name = Utility.localizedHeaderLabel(nationType, FontLibrary.FontSize.SMALL);
    panel.add(name, "span, align center, wrap 40");

    panel.add(Utility.localizedLabel("colopedia.nationType.aggression"));
    panel.add(Utility.localizedLabel("colopedia.nationType."
            + nationType.getAggression().getKey()));

    panel.add(Utility.localizedLabel("colopedia.nationType.settlementNumber"));
    panel.add(Utility.localizedLabel("colopedia.nationType."
            + nationType.getNumberOfSettlements().getKey()));

    panel.add(Utility.localizedLabel("colopedia.nationType.typeOfSettlements"));
    panel.add(new JLabel(Messages.getName(nationType.getCapitalType()),
        new ImageIcon(getImageLibrary().getSettlementImage(nationType.getCapitalType())),
        SwingConstants.CENTER));

    List<String> regionNames = new ArrayList<>();
    for (String regionName : nationType.getRegions()) {
        regionNames.add(Messages.getName(regionName));
    }
    panel.add(Utility.localizedLabel("colopedia.nationType.regions"));
    panel.add(new JLabel(join(", ", regionNames)));

    panel.add(Utility.localizedLabel("colopedia.nationType.skills"), "top, newline 20");
    GridLayout gridLayout = new GridLayout(0, 2);
    gridLayout.setHgap(10);
    JPanel unitPanel = new JPanel(gridLayout);
    unitPanel.setOpaque(false);
    for (RandomChoice<UnitType> choice : skills) {
        unitPanel.add(getUnitButton(choice.getObject()));
    }
    panel.add(unitPanel);
}
项目:smile_1.5.0_java7    文件:FontChooser.java   
private JDialog createDialog(Component parent) {
    Frame frame = parent instanceof Frame ? (Frame) parent
            : (Frame) SwingUtilities.getAncestorOfClass(Frame.class, parent);
    JDialog dialog = new JDialog(frame, getMessage("SelectFont"), true);

    Action okAction = new DialogOKAction(dialog);
    Action cancelAction = new DialogCancelAction(dialog);

    JButton okButton = new JButton(okAction);
    okButton.setFont(DEFAULT_FONT);
    JButton cancelButton = new JButton(cancelAction);
    cancelButton.setFont(DEFAULT_FONT);

    JPanel buttonsPanel = new JPanel();
    buttonsPanel.setLayout(new GridLayout(2, 1));
    buttonsPanel.add(okButton);
    buttonsPanel.add(cancelButton);
    buttonsPanel.setBorder(BorderFactory.createEmptyBorder(25, 0, 10, 10));

    ActionMap actionMap = buttonsPanel.getActionMap();
    actionMap.put(cancelAction.getValue(Action.DEFAULT), cancelAction);
    actionMap.put(okAction.getValue(Action.DEFAULT), okAction);
    InputMap inputMap = buttonsPanel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    inputMap.put(KeyStroke.getKeyStroke("ESCAPE"), cancelAction.getValue(Action.DEFAULT));
    inputMap.put(KeyStroke.getKeyStroke("ENTER"), okAction.getValue(Action.DEFAULT));

    JPanel dialogEastPanel = new JPanel();
    dialogEastPanel.setLayout(new BorderLayout());
    dialogEastPanel.add(buttonsPanel, BorderLayout.NORTH);

    dialog.getContentPane().add(this, BorderLayout.CENTER);
    dialog.getContentPane().add(dialogEastPanel, BorderLayout.EAST);
    dialog.pack();
    dialog.setLocationRelativeTo(frame);
    return dialog;
}
项目:QN-ACTR-Release    文件:IterationSelector.java   
/**
 * Initialize all gui objects
 */
private void initComponents() {
    setLayout(new BorderLayout());
    JPanel topPanel = new JPanel(new GridLayout(2, 1));
    topPanel.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));
    JLabel label = new JLabel("Execution number: ");
    final JSpinner spinner = new JSpinner();
    spinner.setPreferredSize(DIM_SPINNER);
    spinner.setValue(new Integer(1));
    label.setLabelFor(spinner);
    // Pack spinner and its label on top, while description is on the second line
    JPanel tmp = new JPanel();
    tmp.add(label);
    tmp.add(spinner);
    topPanel.add(tmp);
    description.setHorizontalAlignment(SwingConstants.CENTER);
    topPanel.add(description);
    // Adds state change to spinner.
    spinner.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            int i = ((Integer) spinner.getValue()).intValue();
            if (i <= 0) {
                i = 1;
            }
            if (i > model.getWhatIfValues().length) {
                i = model.getWhatIfValues().length;
            }
            select(i - 1);
            spinner.setValue(new Integer(i));
        }
    });

    add(topPanel, BorderLayout.NORTH);
    add(tabber, BorderLayout.CENTER);
    select(0);
}