Example usage for com.jgoodies.forms.layout CellConstraints xy

List of usage examples for com.jgoodies.forms.layout CellConstraints xy

Introduction

In this page you can find the example usage for com.jgoodies.forms.layout CellConstraints xy.

Prototype

public CellConstraints xy(int col, int row) 

Source Link

Document

Sets column and row origins; sets width and height to 1; uses the default alignments.

Examples:

 cc.xy(1, 1); cc.xy(1, 3); 

Usage

From source file:ch.zhaw.ias.dito.ui.util.SingleHistogramPanel.java

License:BSD License

public SingleHistogramPanel(Matrix m) {
    super(new BorderLayout());
    this.m = m;/* w ww  . ja  v a 2  s . c om*/
    this.chart = createChart();
    this.chartPanel = new ChartPanel(this.chart);

    Border border = BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4),
            BorderFactory.createEtchedBorder());
    this.chartPanel.setBorder(border);
    add(this.chartPanel, BorderLayout.CENTER);

    JPanel dashboard = new JPanel(new BorderLayout());
    dashboard.setBorder(BorderFactory.createEmptyBorder(0, 4, 4, 4));

    this.spinner = new JSpinner(new SpinnerNumberModel(0, 0, m.getColCount() - 1, 1));
    spinner.addChangeListener(this);
    this.slider = new JSlider(0, m.getColCount() - 1, 0);
    slider.setPaintLabels(true);

    slider.setMajorTickSpacing(Math.max(50, 10 * Math.round(m.getColCount() / 100)));
    slider.setPaintTicks(true);
    this.slider.addChangeListener(this);

    FormLayout layout = new FormLayout("fill:0:g, max(20dlu; pref)", "top:pref");
    CellConstraints cc = new CellConstraints();
    DefaultFormBuilder fb = new DefaultFormBuilder(layout, Translation.INSTANCE.getBundle());

    fb.add(slider, cc.xy(1, 1));
    fb.add(spinner, cc.xy(2, 1));

    dashboard.add(fb.getPanel(), BorderLayout.CENTER);
    add(dashboard, BorderLayout.SOUTH);
    switchColumn(0);
}

From source file:clockplugin.ClockSettingsTab.java

License:GNU General Public License

public JPanel createSettingsPanel() {
    FormLayout layout = new FormLayout("5dlu,pref,3dlu,pref,pref:grow,10dlu",
            "5dlu,pref,pref,pref,pref,5dlu,pref,2dlu,pref," + "pref,10dlu,pref,pref");
    PanelBuilder pb = new PanelBuilder(layout);
    CellConstraints cc = new CellConstraints();

    mMove = new JCheckBox(mLocalizer.msg("moveonscreen", "Move clock on screen with TV-Browser"));
    mMove.setSelected(ClockPlugin.getInstance().getMoveOnScreen());

    mShowBorder = new JCheckBox(mLocalizer.msg("clockborder", "Clock with border"));
    mShowBorder.setSelected(ClockPlugin.getInstance().getShowBorder());

    mTitleClock = new JCheckBox(mLocalizer.msg("titlebar", "Clock in the title bar"));
    mTitleClock.setSelected(ClockPlugin.getInstance().getTitleBarClock());

    mBox = new JCheckBox(mLocalizer.msg("forever", "Show clock forever"));
    mBox.setSelected(ClockPlugin.getInstance().getShowForever());
    mBox.addActionListener(this);

    mUsePersonaColors = new JCheckBox(mLocalizer.msg("usePersonaColors", "Use Colors of Persona"),
            ClockPlugin.getInstance().isUsingPersonaColors());
    mUseTransparency = new JCheckBox(mLocalizer.msg("useTransparency", "Clock transparent"),
            ClockPlugin.getInstance().isUsingTransparentBackground());

    mTime = new JSpinner();
    mTime.setModel(new SpinnerNumberModel(ClockPlugin.getInstance().getTimeValue(), 5, 30, 1));

    mFontSize = new JSpinner();
    mFontSize.setModel(new SpinnerNumberModel(ClockPlugin.getInstance().getFontValue(), 10, 30, 1));

    pb.add(mMove, cc.xyw(2, 2, 4));//  w ww . j  av a 2 s.c  o m
    pb.add(mShowBorder, cc.xyw(2, 3, 4));
    pb.add(mTitleClock, cc.xyw(2, 4, 4));
    pb.add(mBox, cc.xyw(2, 5, 4));

    int y = 6;

    try {
        Class.forName("util.ui.persona.Persona");
        layout.insertRow(y, RowSpec.decode("default"));
        pb.add(mUsePersonaColors, cc.xyw(2, y++, 4));
    } catch (ClassNotFoundException e) {
    }

    boolean showTransparencySelection = false;

    GraphicsDevice[] devices = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices();
    GraphicsConfiguration config = devices[0].getDefaultConfiguration();

    try {
        Class<?> awtUtilities = Class.forName("com.sun.awt.AWTUtilities");
        Method m = awtUtilities.getMethod("isTranslucencyCapable",
                new Class<?>[] { GraphicsConfiguration.class });

        showTransparencySelection = (Boolean) m.invoke(awtUtilities, new Object[] { config });
    } catch (Exception e) {
        e.printStackTrace();
        try {
            Method m = config.getClass().getMethod("isTranslucencyCapable()",
                    new Class<?>[] { GraphicsConfiguration.class });
            showTransparencySelection = (Boolean) m.invoke(config, new Object[0]);
        } catch (Exception e1) {
            e1.printStackTrace();
        }
    }

    if (showTransparencySelection) {
        layout.insertRow(y, RowSpec.decode("default"));
        pb.add(mUseTransparency, cc.xyw(2, y++, 4));
    }

    mLabel = pb.addLabel(mLocalizer.msg("desc", "Duration of showing the clock in seconds") + ":",
            cc.xy(2, ++y));
    pb.add(mTime, cc.xy(4, y++));
    pb.addLabel(mLocalizer.msg("fsize", "Font size of the clock") + ":", cc.xy(2, ++y));
    pb.add(mFontSize, cc.xy(4, y));
    y += 3;
    pb.addLabel(mLocalizer.msg("info1", "To move the clock on screen click it left"), cc.xyw(2, y++, 4));
    pb.addLabel(mLocalizer.msg("info2", "and move the mouse with pressed left button."), cc.xyw(2, y, 4));

    if (mBox.isSelected()) {
        mTime.setEnabled(false);
        mLabel.setEnabled(false);
    }

    return pb.getPanel();
}

From source file:com.alcatel_lucent.nz.wnmsextract.WNMSTransformGUI.java

License:Open Source License

/**
 * buildPanel. Layout input screen/*w ww  .  j av  a 2  s .  c  o m*/
 * @return
 * r1 | Input Parameters -------------------------------
 * r2 |  XCM Path+Name   [_________]
 * r3 |  XSL Path+Name   [_________]
 * r4 | Logging Outputs---------------------------------
 * r5 |    Log Console   []   Log Level [DEBUG|v]
 * r6 |       Log File   []
 * r6 |   
 * r7 |                  [   START   ][    EXIT    ]
 * ---+-------------------------------------------------
 *    ||c1            |c2|c3  |c4     |c5|c6
 */

private JComponent buildPanel() {

    FormLayout layout = new FormLayout("left:pref", // 2cols
            "pref,pref,3dlu,pref,pref,3dlu,pref"); // 3rows

    PanelBuilder builder = new PanelBuilder(layout);
    builder.setDefaultDialogBorder();

    CellConstraints cc = new CellConstraints();

    builder.addSeparator("Input Parameters", cc.xywh(1, 1, 1, 1));
    builder.add(buildInputPanel(), cc.xy(1, 2));
    builder.addSeparator("Logging Outputs", cc.xywh(1, 4, 1, 1));
    builder.add(buildLogPanel(), cc.xy(1, 5));
    builder.add(buildButtonPanel(), cc.xy(1, 7, "right,center"));

    return builder.getPanel();

}

From source file:com.alcatel_lucent.nz.wnmsextract.WNMSTransformGUI.java

License:Open Source License

private JComponent buildInputPanel() {

    FormLayout layout = new FormLayout("right:pref, 5dlu, 75dlu", //cols
            "pref, 3dlu, pref"); // rows

    PanelBuilder builder = new PanelBuilder(layout);

    CellConstraints cc = new CellConstraints();

    builder.addLabel("Snapshot Name", cc.xy(1, 1));
    builder.add(snapshot, cc.xyw(3, 1, 1));
    builder.addLabel("Stylesheet Name", cc.xy(1, 3));
    builder.add(stylesheet, cc.xyw(3, 3, 1));

    return builder.getPanel();

}

From source file:com.alcatel_lucent.nz.wnmsextract.WNMSTransformGUI.java

License:Open Source License

private JComponent buildLogPanel() {

    FormLayout layout = new FormLayout("right:pref, 5dlu, pref, 5dlu, right:pref, 5dlu, pref", //cols
            "pref,pref"); // rows      

    /*FormLayout layout = new FormLayout(
    "right:pref, 5dlu, pref, pref, 5dlu, pref",         //cols
    "p, 15dlu, 15dlu, p, 15dlu, 3dlu, pref");     // rows
     *//*from   www . j a va  2s .  c  o m*/

    PanelBuilder builder = new PanelBuilder(layout);

    CellConstraints cc = new CellConstraints();

    builder.addLabel("Log Console", cc.xy(1, 1));
    builder.add(logcon, cc.xy(3, 1));
    builder.addLabel("Log File", cc.xy(1, 2));
    builder.add(logfile, cc.xy(3, 2));
    builder.addLabel("Log Level", cc.xy(5, 1));
    builder.add(loglevel, cc.xy(7, 1));

    return builder.getPanel();
}

From source file:com.alcatel_lucent.nz.wnmsextract.WNMSTransformGUI.java

License:Open Source License

private JComponent buildButtonPanel() {

    FormLayout layout = new FormLayout("pref,pref", //cols
            "pref"); // rows

    layout.setColumnGroups(new int[][] { { 1, 2 } });

    PanelBuilder builder = new PanelBuilder(layout);

    CellConstraints cc = new CellConstraints();

    //builder.addSeparator("",cc.xywh(1, 7, 5, 1));
    builder.add(start, cc.xy(1, 1));
    builder.add(exit, cc.xy(2, 1));// w  w w .  j ava2 s . c  om

    return builder.getPanel();
}

From source file:com.allenstudio.ir.ui.NoteOperationsPane.java

License:Open Source License

private void initComponents() {
    CellConstraints cc = new CellConstraints();

    JLabel typeLabel = new JLabel(UIResources.getString("typeLabel") + ":");
    JLabel featureLabel = new JLabel(UIResources.getString("featureLabel") + ":");
    JLabel repetitionLabel = new JLabel(UIResources.getString("repetitionLabel") + ":");
    JLabel moveLabel = new JLabel(UIResources.getString("moveLabel") + ":");

    //======== Panel building ========
    {/*  w ww  .  j av a 2  s  .  c  o  m*/
        this.setContentPaneBorder(BorderFactory.createEmptyBorder(8, 2, 8, 3));

        Container thisContentPane = this.getContentPane();

        thisContentPane.setLayout(new FormLayout(
                new ColumnSpec[] { new ColumnSpec("right:max(default;40dlu)"),
                        FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec("max(default;40dlu)") },
                new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                        FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                        FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC }));

        //---- typeLabel ----
        thisContentPane.add(typeLabel, cc.xy(1, 1));
        thisContentPane.add(typeBox, cc.xy(3, 1));

        //---- featureLabel ----
        thisContentPane.add(featureLabel, cc.xy(1, 3));

        //---- featureButton ----
        featureButton.setText("F:\\Setup.exe");
        thisContentPane.add(featureButton, cc.xy(3, 3));

        //---- repetitionLabel ----
        thisContentPane.add(repetitionLabel, cc.xy(1, 5));
        thisContentPane.add(repetitionBox, cc.xy(3, 5));

        //---- moveLabel ----
        thisContentPane.add(moveLabel, cc.xy(1, 7));

        //---- datePickButton ----
        datePickButton.setText(UIResources.getString("datePickLabel"));
        thisContentPane.add(datePickButton, cc.xy(3, 7));
    }
}

From source file:com.alternatecomputing.jschnizzle.action.AboutAction.java

License:Apache License

/**
 * create the about panel/*from w w  w. java2  s  .  co m*/
 *
 * @param dialog component that will contain this panel
 * @return about panel
 */
private JPanel createAboutPanel(final JDialog dialog) {
    FormLayout layout = new FormLayout("fill:min:grow, pref", "pref, 4dlu, fill:min:grow, 4dlu, pref");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();
    CellConstraints cc = new CellConstraints();
    JXHeader header = new JXHeader("JSchnizzle", "");
    builder.add(header, cc.xywh(1, 1, 2, 1));
    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.addTab("Version", createVersionPanel());
    tabbedPane.addTab("About", createNoticePanel());
    tabbedPane.addTab("License", createLicensePanel());
    tabbedPane.addTab("Acknowledgements", createAcknowledgementsPanel());
    builder.add(tabbedPane, cc.xywh(1, 3, 2, 1));
    JButton okButton = new JButton("OK");
    okButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            dialog.dispose();
        }
    });
    builder.add(ButtonBarFactory.buildOKBar(okButton), cc.xy(2, 5));
    return builder.getPanel();
}

From source file:com.alternatecomputing.jschnizzle.action.AboutAction.java

License:Apache License

/**
 * create the panel containing the version information
 *
 * @return version panel//from w  w  w  .j  ava  2s  .c om
 */
private Component createVersionPanel() {
    JPanel p = createBasicPanel();
    FormLayout layout = new FormLayout("fill:min:grow, pref, 10dlu, pref, 4dlu, pref, fill:min:grow",
            "fill:min:grow, 20dlu, pref, 4dlu, pref, 4dlu, pref, 20dlu, fill:min:grow");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    CellConstraints cc = new CellConstraints();
    JXImagePanel imagePanel = new JXImagePanel();
    imagePanel.setBackground(Color.WHITE);
    try {
        BufferedImage image = ImageIO
                .read(Thread.currentThread().getContextClassLoader().getResource("logo.jpg"));
        imagePanel.setImage(image);
        imagePanel.setPreferredSize(new Dimension(image.getWidth(), image.getHeight()));
    } catch (IOException e) {
        LOGGER.error("Error reading logo image from classpath.", e);
    }
    builder.add(imagePanel, cc.xywh(2, 2, 1, 7));
    Properties buildInfo = getBuildInfo();
    builder.add(new JLabel("Version:"), cc.xy(4, 3));
    builder.add(new JLabel(buildInfo.getProperty("Implementation-Version")), cc.xy(6, 3));
    builder.add(new JLabel("Build Rev:"), cc.xy(4, 5));
    builder.add(new JLabel(buildInfo.getProperty("Implementation-Build")), cc.xy(6, 5));
    builder.add(new JLabel("Build Date:"), cc.xy(4, 7));
    builder.add(new JLabel(buildInfo.getProperty("Implementation-Build-Date").replace("\"", "")), cc.xy(6, 7));
    JPanel panel = builder.getPanel();
    panel.setBackground(Color.WHITE);
    panel.setBorder(BorderFactory.createEtchedBorder());
    p.add(panel, cc.xy(1, 1));
    return p;
}

From source file:com.alternatecomputing.jschnizzle.action.AboutAction.java

License:Apache License

private JPanel createContentPanel(String resourceLocation) {
    JPanel panel = createBasicPanel();
    CellConstraints cc = new CellConstraints();
    JTextPane textPane = new JTextPane();
    URL aboutURL = Thread.currentThread().getContextClassLoader().getResource(resourceLocation);
    try {/*from   ww w. j  ava 2 s  . com*/
        textPane.setPage(aboutURL);
    } catch (IOException e) {
        LOGGER.error("Error loading content from classpath location: " + resourceLocation, e);
    }
    panel.add(new JScrollPane(textPane), cc.xy(1, 1));
    return panel;
}