Example usage for javax.swing JPanel setMinimumSize

List of usage examples for javax.swing JPanel setMinimumSize

Introduction

In this page you can find the example usage for javax.swing JPanel setMinimumSize.

Prototype

@BeanProperty(description = "The minimum size of the component.")
public void setMinimumSize(Dimension minimumSize) 

Source Link

Document

Sets the minimum size of this component to a constant value.

Usage

From source file:brainflow.app.presentation.controls.FileObjectGroupSelector.java

public static void main(String[] args) {
    try {// w w  w  .java2 s  . co  m
        com.jidesoft.utils.Lm.verifyLicense("UIN", "BrainFlow", "S5XiLlHH0VReaWDo84sDmzPxpMJvjP3");
        //com.jidesoft.plaf.LookAndFeelFactory.installDefaultLookAndFeel();
        //LookAndFeelFactory.installJideExtension(LookAndFeelFactory.OFFICE2007_STYLE);
        UIManager.setLookAndFeel(new NimbusLookAndFeel());
        JFrame jf = new JFrame();
        FileObjectGroupSelector selector = new FileObjectGroupSelector(
                VFS.getManager().resolveFile("c:/javacode"));

        ButtonPanel buttonPanel = new ButtonPanel(SwingConstants.RIGHT);
        buttonPanel.setSizeConstraint(ButtonPanel.NO_LESS_THAN);

        JButton okButton = new JButton("OK");
        JButton resetButton = new JButton("Cancel");

        buttonPanel.addButton(okButton, ButtonPanel.AFFIRMATIVE_BUTTON);
        buttonPanel.addButton(resetButton, ButtonPanel.CANCEL_BUTTON);

        buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 8, 8, 8));

        JPanel panel = new JPanel();
        panel.setLayout(new BorderLayout());
        panel.add(selector, BorderLayout.CENTER);
        panel.add(buttonPanel, BorderLayout.SOUTH);
        panel.setMinimumSize(new Dimension(800, 100));
        jf.add(panel, BorderLayout.CENTER);
        jf.pack();
        jf.setVisible(true);
    } catch (Exception e) {
        e.printStackTrace();

    }

}

From source file:Main.java

public static JPanel getPanelFlowLayoutHorizontal(int w, int h, int type) {
    JPanel panel = new JPanel();
    FlowLayout layout = new FlowLayout();
    layout.setAlignment(type);//from   www.  j av a 2s .  c  o  m
    panel.setLayout(layout);
    panel.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
    panel.setPreferredSize(getControlDimension(w, h));
    panel.setMinimumSize(getControlDimension(w, h));
    return panel;
}

From source file:kevin.gvmsgarch.App.java

public static void showErrorDialog(final Exception text) {
    try {/*from www.ja  va2  s .  com*/
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                JPanel panel = new JPanel();
                JTextArea textArea = new JTextArea();

                JScrollPane scroll = new JScrollPane(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                        JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
                scroll.setMinimumSize(new Dimension(800, 240));
                panel.add(scroll);
                panel.setMinimumSize(new Dimension(800, 240));

                ByteArrayOutputStream baos;
                text.printStackTrace(new PrintStream(baos = new ByteArrayOutputStream()));

                textArea.setText(new String(baos.toByteArray()));
                JOptionPane.showConfirmDialog(null, panel, "Why did this happen?", JOptionPane.OK_CANCEL_OPTION,
                        JOptionPane.ERROR_MESSAGE);
            }
        });
    } catch (Exception ex) {
        System.err.println("ermmm...?");
        ex.printStackTrace();
    }

}

From source file:gui.images.CodebookVectorProfilePanel.java

/**
 * Sets the data to be shown./*  www .  jav a 2s  .c o  m*/
 *
 * @param occurrenceProfile Double array that is the neighbor occurrence
 * profile of this visual word.
 * @param codebookIndex Integer that is the index of this visual word.
 * @param classColors Color[] of class colors.
 * @param classNames String[] of class names.
 */
public void setResults(double[] occurrenceProfile, int codebookIndex, Color[] classColors,
        String[] classNames) {
    int numClasses = Math.min(classNames.length, occurrenceProfile.length);
    this.codebookIndex = codebookIndex;
    this.occurrenceProfile = occurrenceProfile;
    DefaultPieDataset pieData = new DefaultPieDataset();
    for (int cIndex = 0; cIndex < numClasses; cIndex++) {
        pieData.setValue(classNames[cIndex], occurrenceProfile[cIndex]);
    }
    JFreeChart chart = ChartFactory.createPieChart3D("codebook vect " + codebookIndex, pieData, true, true,
            false);
    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);
    PieRenderer prend = new PieRenderer(classColors);
    prend.setColor(plot, pieData);
    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new Dimension(140, 140));
    chartPanel.setVisible(true);
    chartPanel.revalidate();
    chartPanel.repaint();
    JPanel jp = new JPanel();
    jp.setPreferredSize(new Dimension(140, 140));
    jp.setMinimumSize(new Dimension(140, 140));
    jp.setMaximumSize(new Dimension(140, 140));
    jp.setSize(new Dimension(140, 140));
    jp.setLayout(new FlowLayout());
    jp.add(chartPanel);
    jp.setVisible(true);
    jp.validate();
    jp.repaint();

    JFrame frame = new JFrame();
    frame.setBackground(Color.WHITE);
    frame.setUndecorated(true);
    frame.getContentPane().add(jp);
    frame.pack();
    BufferedImage bi = new BufferedImage(jp.getWidth(), jp.getHeight(), BufferedImage.TYPE_INT_ARGB);
    Graphics2D graphics = bi.createGraphics();
    jp.print(graphics);
    graphics.dispose();
    frame.dispose();
    imPanel.removeAll();
    imPanel.setImage(bi);
    imPanel.setVisible(true);
    imPanel.revalidate();
    imPanel.repaint();
}

From source file:brainflow.app.presentation.controls.FileObjectGroupSelector.java

private JideSplitPane createSplitPane() {
    JPanel treePanel = new JPanel();
    treePanel.setLayout(new BorderLayout());
    treePanel.setMinimumSize(new Dimension(300, 100));
    treePanel.add(new JScrollPane(explorer.getComponent()), BorderLayout.CENTER);
    splitPane = new JideSplitPane(JideSplitPane.HORIZONTAL_SPLIT);
    splitPane.setProportionalLayout(true);

    treePanel.setBorder(BorderFactory.createTitledBorder("File System"));
    splitPane.add(treePanel, JideBoxLayout.FLEXIBLE);

    JScrollPane jsp = new JScrollPane(fileList);
    jsp.setBorder(BorderFactory.createTitledBorder("Filter Selection"));
    splitPane.add(jsp, JideBoxLayout.VARY);
    splitPane.setProportions(new double[] { .55 });
    return splitPane;

}

From source file:com.eviware.soapui.impl.rest.panels.request.RestRequestDesktopPanel.java

private JPanel addMethodCombo() {
    JPanel methodPanel = new JPanel(new BorderLayout());
    JComboBox methodComboBox = new JComboBox(new RestRequestMethodModel(getRequest()));
    methodComboBox.setSelectedItem(getRequest().getMethod());

    JLabel methodLabel = new JLabel("Method");
    methodPanel.add(methodLabel, BorderLayout.NORTH);
    methodPanel.add(methodComboBox, BorderLayout.SOUTH);
    methodPanel.setMinimumSize(new Dimension(75, STANDARD_TOOLBAR_HEIGHT));
    methodPanel.setMaximumSize(new Dimension(75, STANDARD_TOOLBAR_HEIGHT + 10));
    return methodPanel;
}

From source file:net.sf.firemox.ui.wizard.About.java

/**
 * Creates a new instance of About <br>
 * //from  www  .  ja v a2 s . c  o m
 * @param parent
 */
public About(JFrame parent) {
    super(LanguageManager.getString("wiz_about.title"), LanguageManager.getString("wiz_about.description"),
            "mp64.gif", LanguageManager.getString("close"), 420, 620);
    JPanel thanksPanel = new JPanel();

    thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS));
    thanksPanel.setMaximumSize(new Dimension(32767, 26));
    thanksPanel.setOpaque(false);
    JLabel jLabel5 = new JLabel(LanguageManager.getString("version") + " : ");
    jLabel5.setFont(MToolKit.defaultFont);
    jLabel5.setHorizontalAlignment(SwingConstants.RIGHT);
    jLabel5.setMaximumSize(new Dimension(100, 16));
    jLabel5.setMinimumSize(new Dimension(100, 16));
    jLabel5.setPreferredSize(new Dimension(100, 16));
    thanksPanel.add(jLabel5);
    jLabel5 = new JLabel(IdConst.VERSION);
    thanksPanel.add(jLabel5);
    gameParamPanel.add(thanksPanel);

    thanksPanel = new JPanel();
    thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS));
    thanksPanel.setOpaque(false);
    JPanel thanksPanelLeft = new JPanel(new FlowLayout(FlowLayout.LEADING));
    thanksPanelLeft.setLayout(new BoxLayout(thanksPanelLeft, BoxLayout.Y_AXIS));
    thanksPanelLeft.setMaximumSize(new Dimension(100, 2000));
    thanksPanelLeft.setMinimumSize(new Dimension(100, 16));
    jLabel5 = new JLabel(LanguageManager.getString("thanks") + " : ");
    jLabel5.setFont(MToolKit.defaultFont);
    jLabel5.setHorizontalAlignment(SwingConstants.RIGHT);
    jLabel5.setMaximumSize(new Dimension(100, 16));
    jLabel5.setMinimumSize(new Dimension(100, 16));
    jLabel5.setPreferredSize(new Dimension(100, 16));
    thanksPanelLeft.add(jLabel5);
    thanksPanel.add(thanksPanelLeft);
    thanksPanelLeft = new JPanel();
    thanksPanelLeft.setLayout(new BoxLayout(thanksPanelLeft, BoxLayout.Y_AXIS));
    StringBuilder contributors = new StringBuilder();
    addContributor(contributors, "Fabrice Daugan", "developper", "france");
    addContributor(contributors, "Hoani Cross", "developper", "frenchpolynesia");
    addContributor(contributors, "nico100", "graphist", "france");
    addContributor(contributors, "seingalt_tm", "graphist", "france");
    addContributor(contributors, "surtur2", "tester", null);
    addContributor(contributors, "Jan Blaha", "developper", "cz");
    addContributor(contributors, "Tureba", "developper", "brazil");
    addContributor(contributors, "hakvf", "tester", "france");
    addContributor(contributors, "Stefano \"Kismet\" Lenzi", "developper", "italian");
    jLabel5 = new JLabel(contributors.toString());
    jLabel5.setFont(MToolKit.defaultFont);
    jLabel5.setHorizontalAlignment(SwingConstants.LEFT);
    thanksPanelLeft.add(jLabel5);
    jLabel5 = new JLink("http://obsidiurne.free.fr", "morgil has designed the splash screen");
    jLabel5.setFont(MToolKit.defaultFont);
    thanksPanelLeft.add(jLabel5);
    thanksPanel.add(thanksPanelLeft);

    gameParamPanel.add(thanksPanel);

    thanksPanel = new JPanel();
    thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS));
    thanksPanel.setMaximumSize(new Dimension(32767, 26));
    thanksPanel.setOpaque(false);
    JLabel blanklbl = new JLabel();
    blanklbl.setHorizontalAlignment(SwingConstants.RIGHT);
    blanklbl.setMaximumSize(new Dimension(100, 16));
    blanklbl.setMinimumSize(new Dimension(100, 16));
    blanklbl.setPreferredSize(new Dimension(100, 16));
    thanksPanel.add(blanklbl);

    jLabel5 = new JLink(
            "http://sourceforge.net/tracker/?func=add&group_id=" + IdConst.PROJECT_ID + "&atid=601043",
            LanguageManager.getString("joindev"));
    jLabel5.setFont(MToolKit.defaultFont);
    thanksPanel.add(jLabel5);
    gameParamPanel.add(thanksPanel);

    thanksPanel = new JPanel();
    thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS));
    thanksPanel.setOpaque(false);
    jLabel5 = new JLabel(LanguageManager.getString("projecthome") + " : ");
    jLabel5.setFont(MToolKit.defaultFont);
    jLabel5.setHorizontalAlignment(SwingConstants.RIGHT);
    jLabel5.setMaximumSize(new Dimension(100, 16));
    jLabel5.setMinimumSize(new Dimension(100, 16));
    jLabel5.setPreferredSize(new Dimension(100, 16));
    thanksPanel.add(jLabel5);
    jLabel5 = new JLink(IdConst.MAIN_PAGE, IdConst.MAIN_PAGE);
    jLabel5.setFont(MToolKit.defaultFont);
    thanksPanel.add(jLabel5);
    gameParamPanel.add(thanksPanel);

    // forum francais
    thanksPanel = new JPanel();
    thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS));
    thanksPanel.setOpaque(false);
    jLabel5 = new JLabel(LanguageManager.getString("othersites") + " : ");
    jLabel5.setFont(MToolKit.defaultFont);
    jLabel5.setHorizontalAlignment(SwingConstants.RIGHT);
    jLabel5.setMaximumSize(new Dimension(100, 16));
    jLabel5.setMinimumSize(new Dimension(100, 16));
    jLabel5.setPreferredSize(new Dimension(100, 16));
    thanksPanel.add(jLabel5);
    jLabel5 = new JLink("http://www.Firemox.fr.st", UIHelper.getIcon("mpfrsml.gif"), SwingConstants.LEFT);
    jLabel5.setToolTipText(LanguageManager.getString("frenchforum.tooltip"));
    thanksPanel.add(jLabel5);
    jLabel5 = new JLabel();
    jLabel5.setMaximumSize(new Dimension(1000, 16));
    thanksPanel.add(jLabel5);
    gameParamPanel.add(thanksPanel);

    JTextArea disclaimer = new JTextArea();
    disclaimer.setEditable(false);
    disclaimer.setLineWrap(true);
    disclaimer.setWrapStyleWord(true);
    disclaimer.setAutoscrolls(true);
    disclaimer.setTabSize(2);
    disclaimer.setFont(new Font("Arial", 0, 10));
    // Then try and read it locally
    BufferedReader inGPL = null;
    try {
        inGPL = new BufferedReader(new InputStreamReader(MToolKit.getResourceAsStream(IdConst.FILE_LICENSE)));
        disclaimer.read(inGPL, "");
    } catch (IOException e) {
        e.printStackTrace();
    } finally {
        IOUtils.closeQuietly(inGPL);
    }
    JScrollPane disclaimerSPanel = new JScrollPane();
    disclaimerSPanel.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    MToolKit.addOverlay(disclaimerSPanel);
    disclaimerSPanel.setViewportView(disclaimer);
    gameParamPanel.add(disclaimerSPanel);
}

From source file:executor.TesterMainGUIMode.java

/**
 * Add chart panel to the frame/*  ww  w  .  ja v  a2  s  . c  o m*/
 */
private void addChartPanel(JPanel chartPanel) {
    removecurrentChartPanel();

    this.currentChartPanel = chartPanel;
    chartPanel.setPreferredSize(new Dimension(frameWidth, frameHeight - controlPanelHeight));
    chartPanel.setMinimumSize(new Dimension(frameWidth, 200));
    chartPanel.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));
    getContentPane().add(chartPanel);
    this.validate();
    chartPanel.repaint();
}

From source file:events.ListSelectionDemo.java

public ListSelectionDemo() {
    super(new BorderLayout());

    String[] listData = { "one", "two", "three", "four", "five", "six", "seven" };
    String[] columnNames = { "French", "Spanish", "Italian" };
    list = new JList(listData);

    listSelectionModel = list.getSelectionModel();
    listSelectionModel.addListSelectionListener(new SharedListSelectionHandler());
    JScrollPane listPane = new JScrollPane(list);

    JPanel controlPane = new JPanel();
    String[] modes = { "SINGLE_SELECTION", "SINGLE_INTERVAL_SELECTION", "MULTIPLE_INTERVAL_SELECTION" };

    final JComboBox comboBox = new JComboBox(modes);
    comboBox.setSelectedIndex(2);/*from w  w  w .  ja v  a  2  s.  c  om*/
    comboBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            String newMode = (String) comboBox.getSelectedItem();
            if (newMode.equals("SINGLE_SELECTION")) {
                listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
            } else if (newMode.equals("SINGLE_INTERVAL_SELECTION")) {
                listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
            } else {
                listSelectionModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
            }
            output.append("----------" + "Mode: " + newMode + "----------" + newline);
        }
    });
    controlPane.add(new JLabel("Selection mode:"));
    controlPane.add(comboBox);

    //Build output area.
    output = new JTextArea(1, 10);
    output.setEditable(false);
    JScrollPane outputPane = new JScrollPane(output, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);

    //Do the layout.
    JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    add(splitPane, BorderLayout.CENTER);

    JPanel topHalf = new JPanel();
    topHalf.setLayout(new BoxLayout(topHalf, BoxLayout.LINE_AXIS));
    JPanel listContainer = new JPanel(new GridLayout(1, 1));
    listContainer.setBorder(BorderFactory.createTitledBorder("List"));
    listContainer.add(listPane);

    topHalf.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));
    topHalf.add(listContainer);
    //topHalf.add(tableContainer);

    topHalf.setMinimumSize(new Dimension(100, 50));
    topHalf.setPreferredSize(new Dimension(100, 110));
    splitPane.add(topHalf);

    JPanel bottomHalf = new JPanel(new BorderLayout());
    bottomHalf.add(controlPane, BorderLayout.PAGE_START);
    bottomHalf.add(outputPane, BorderLayout.CENTER);
    //XXX: next line needed if bottomHalf is a scroll pane:
    //bottomHalf.setMinimumSize(new Dimension(400, 50));
    bottomHalf.setPreferredSize(new Dimension(450, 135));
    splitPane.add(bottomHalf);
}

From source file:ListSelectionDemo.java

public ListSelectionDemo() {
    super(new BorderLayout());

    String[] listData = { "one", "two", "three", "four", "five", "six", "seven" };
    String[] columnNames = { "French", "Spanish", "Italian" };
    list = new JList(listData);

    listSelectionModel = list.getSelectionModel();
    listSelectionModel.addListSelectionListener(new SharedListSelectionHandler());
    JScrollPane listPane = new JScrollPane(list);

    JPanel controlPane = new JPanel();
    String[] modes = { "SINGLE_SELECTION", "SINGLE_INTERVAL_SELECTION", "MULTIPLE_INTERVAL_SELECTION" };

    final JComboBox comboBox = new JComboBox(modes);
    comboBox.setSelectedIndex(2);//w ww. ja  v a2 s .co m
    comboBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            String newMode = (String) comboBox.getSelectedItem();
            if (newMode.equals("SINGLE_SELECTION")) {
                listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
            } else if (newMode.equals("SINGLE_INTERVAL_SELECTION")) {
                listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
            } else {
                listSelectionModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
            }
            output.append("----------" + "Mode: " + newMode + "----------" + newline);
        }
    });
    controlPane.add(new JLabel("Selection mode:"));
    controlPane.add(comboBox);

    // Build output area.
    output = new JTextArea(1, 10);
    output.setEditable(false);
    JScrollPane outputPane = new JScrollPane(output, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);

    // Do the layout.
    JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    add(splitPane, BorderLayout.CENTER);

    JPanel topHalf = new JPanel();
    topHalf.setLayout(new BoxLayout(topHalf, BoxLayout.LINE_AXIS));
    JPanel listContainer = new JPanel(new GridLayout(1, 1));
    listContainer.setBorder(BorderFactory.createTitledBorder("List"));
    listContainer.add(listPane);

    topHalf.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));
    topHalf.add(listContainer);
    // topHalf.add(tableContainer);

    topHalf.setMinimumSize(new Dimension(100, 50));
    topHalf.setPreferredSize(new Dimension(100, 110));
    splitPane.add(topHalf);

    JPanel bottomHalf = new JPanel(new BorderLayout());
    bottomHalf.add(controlPane, BorderLayout.PAGE_START);
    bottomHalf.add(outputPane, BorderLayout.CENTER);
    // XXX: next line needed if bottomHalf is a scroll pane:
    // bottomHalf.setMinimumSize(new Dimension(400, 50));
    bottomHalf.setPreferredSize(new Dimension(450, 135));
    splitPane.add(bottomHalf);
}