Example usage for javax.swing SwingConstants LEFT

List of usage examples for javax.swing SwingConstants LEFT

Introduction

In this page you can find the example usage for javax.swing SwingConstants LEFT.

Prototype

int LEFT

To view the source code for javax.swing SwingConstants LEFT.

Click Source Link

Document

Box-orientation constant used to specify the left side of a box.

Usage

From source file:op.controlling.PnlQMSSchedule.java

/**
 * This method is called from within the constructor to
 * initialize the form./*w w w. jav a  2  s  .co m*/
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the PrinterForm Editor.
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    panelMain = new JPanel();
    lblMeasure = new JLabel();
    txtQMS = new JTextField();
    lblLocation = new JLabel();
    cmbLocation = new TreeComboBox();
    tabWdh = new JideTabbedPane();
    pnlDaily = new JPanel();
    lblEveryDay = new JLabel();
    spinTaeglich = new JSpinner();
    lblDays = new JLabel();
    btnJedenTag = new JButton();
    pnlWeekly = new JPanel();
    panel3 = new JPanel();
    btnJedeWoche = new JButton();
    lblEveryWeek = new JLabel();
    spinWoche = new JSpinner();
    lblWeeks = new JLabel();
    lblUhrzeit2 = new JideLabel();
    lblUhrzeit3 = new JideLabel();
    lblUhrzeit4 = new JideLabel();
    lblUhrzeit5 = new JideLabel();
    lblUhrzeit6 = new JideLabel();
    lblUhrzeit7 = new JideLabel();
    lblUhrzeit8 = new JideLabel();
    cbMon = new JRadioButton();
    cbDie = new JRadioButton();
    cbMit = new JRadioButton();
    cbDon = new JRadioButton();
    cbFre = new JRadioButton();
    cbSam = new JRadioButton();
    cbSon = new JRadioButton();
    pnlMonthly = new JPanel();
    lblEveryMonth = new JLabel();
    spinMonat = new JSpinner();
    lblMonth = new JLabel();
    btnJedenMonat = new JButton();
    llblOnDayOfMonth = new JLabel();
    spinDayInMonth = new JSpinner();
    cmbTag = new JComboBox<>();
    pnlYearly = new JPanel();
    lblEveryYear = new JLabel();
    spinYearly = new JSpinner();
    lblYear = new JLabel();
    btnEveryYear = new JButton();
    lblOnDay = new JLabel();
    spinDayInMonthInYear = new JSpinner();
    cmbMonth = new JComboBox();
    lblLDate = new JLabel();
    jdcStartingOn = new JDateChooser();
    jScrollPane1 = new JScrollPane();
    txtBemerkung = new JTextArea();
    btnSave = new JButton();
    lblDueDays = new JLabel();
    txtDueDays = GUITools.createIntegerTextField(1, 31, 1);

    //======== this ========
    setLayout(new BorderLayout());

    //======== panelMain ========
    {
        panelMain.setBorder(new LineBorder(Color.black, 2, true));
        panelMain.addComponentListener(new ComponentAdapter() {
            @Override
            public void componentResized(ComponentEvent e) {
                panelMainComponentResized(e);
            }
        });
        panelMain.setLayout(new FormLayout("$rgap, $lcgap, 35dlu:grow, $ugap, 105dlu:grow, $lcgap, $rgap",
                "default, $nlgap, 18dlu, $lgap, default, $nlgap, 2*(default, $lgap), pref, $lgap, default, $nlgap, default, $lgap, 72dlu:grow, $lgap, default, $lgap, $rgap"));

        //---- lblMeasure ----
        lblMeasure.setText("text");
        lblMeasure.setFont(new Font("Arial", Font.PLAIN, 10));
        lblMeasure.setHorizontalAlignment(SwingConstants.TRAILING);
        panelMain.add(lblMeasure, CC.xy(5, 1));

        //---- txtQMS ----
        txtQMS.setFont(new Font("Arial", Font.BOLD, 14));
        panelMain.add(txtQMS, CC.xywh(3, 3, 3, 1, CC.DEFAULT, CC.FILL));

        //---- lblLocation ----
        lblLocation.setText("text");
        lblLocation.setFont(new Font("Arial", Font.PLAIN, 10));
        lblLocation.setHorizontalAlignment(SwingConstants.TRAILING);
        panelMain.add(lblLocation, CC.xy(5, 5));
        panelMain.add(cmbLocation, CC.xy(5, 7));

        //======== tabWdh ========
        {

            //======== pnlDaily ========
            {
                pnlDaily.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlDaily.setLayout(new FormLayout("2*(default), $rgap, $lcgap, 40dlu, $rgap, default",
                        "default, $lgap, pref, $lgap, default"));

                //---- lblEveryDay ----
                lblEveryDay.setText("alle");
                lblEveryDay.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlDaily.add(lblEveryDay, CC.xy(2, 3));

                //---- spinTaeglich ----
                spinTaeglich.setFont(new Font("Arial", Font.PLAIN, 14));
                spinTaeglich.setModel(new SpinnerNumberModel(1, null, null, 1));
                pnlDaily.add(spinTaeglich, CC.xy(5, 3));

                //---- lblDays ----
                lblDays.setText("Tage");
                lblDays.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlDaily.add(lblDays, CC.xy(7, 3));

                //---- btnJedenTag ----
                btnJedenTag.setText("Jeden Tag");
                btnJedenTag.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        btnJedenTagActionPerformed(e);
                    }
                });
                pnlDaily.add(btnJedenTag, CC.xywh(2, 5, 6, 1));
            }
            tabWdh.addTab("T\u00e4glich", pnlDaily);

            //======== pnlWeekly ========
            {
                pnlWeekly.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlWeekly.setLayout(new FormLayout("default, 7*(13dlu), $lcgap, default:grow",
                        "$ugap, $lgap, default, $lgap, fill:53dlu:grow, $nlgap, default:grow, $lgap, $rgap"));

                //======== panel3 ========
                {
                    panel3.setLayout(
                            new FormLayout("default, $rgap, 40dlu, $rgap, 2*(default), $lcgap, default, $lcgap",
                                    "default:grow, $lgap, default"));

                    //---- btnJedeWoche ----
                    btnJedeWoche.setText("Jede Woche");
                    btnJedeWoche.setFont(new Font("Arial", Font.PLAIN, 14));
                    btnJedeWoche.addActionListener(new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent e) {
                            btnJedeWocheActionPerformed(e);
                        }
                    });
                    panel3.add(btnJedeWoche, CC.xywh(3, 3, 3, 1));

                    //---- lblEveryWeek ----
                    lblEveryWeek.setText("alle");
                    lblEveryWeek.setFont(new Font("Arial", Font.PLAIN, 14));
                    panel3.add(lblEveryWeek, CC.xy(1, 1));
                    panel3.add(spinWoche, CC.xy(3, 1));

                    //---- lblWeeks ----
                    lblWeeks.setText("Wochen am");
                    lblWeeks.setFont(new Font("Arial", Font.PLAIN, 14));
                    panel3.add(lblWeeks, CC.xy(5, 1));
                }
                pnlWeekly.add(panel3, CC.xywh(2, 3, 9, 1));

                //---- lblUhrzeit2 ----
                lblUhrzeit2.setText("montags");
                lblUhrzeit2.setOrientation(1);
                lblUhrzeit2.setFont(new Font("Arial", Font.PLAIN, 14));
                lblUhrzeit2.setClockwise(false);
                lblUhrzeit2.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblUhrzeit2, CC.xy(2, 5, CC.CENTER, CC.BOTTOM));

                //---- lblUhrzeit3 ----
                lblUhrzeit3.setText("dienstags");
                lblUhrzeit3.setOrientation(1);
                lblUhrzeit3.setFont(new Font("Arial", Font.PLAIN, 14));
                lblUhrzeit3.setClockwise(false);
                lblUhrzeit3.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblUhrzeit3, CC.xy(3, 5, CC.CENTER, CC.BOTTOM));

                //---- lblUhrzeit4 ----
                lblUhrzeit4.setText("mittwochs");
                lblUhrzeit4.setOrientation(1);
                lblUhrzeit4.setFont(new Font("Arial", Font.PLAIN, 14));
                lblUhrzeit4.setClockwise(false);
                lblUhrzeit4.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblUhrzeit4, CC.xy(4, 5, CC.CENTER, CC.BOTTOM));

                //---- lblUhrzeit5 ----
                lblUhrzeit5.setText("donnerstags");
                lblUhrzeit5.setOrientation(1);
                lblUhrzeit5.setFont(new Font("Arial", Font.PLAIN, 14));
                lblUhrzeit5.setClockwise(false);
                lblUhrzeit5.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblUhrzeit5, CC.xy(5, 5, CC.CENTER, CC.BOTTOM));

                //---- lblUhrzeit6 ----
                lblUhrzeit6.setText("freitags");
                lblUhrzeit6.setOrientation(1);
                lblUhrzeit6.setFont(new Font("Arial", Font.PLAIN, 14));
                lblUhrzeit6.setClockwise(false);
                lblUhrzeit6.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblUhrzeit6, CC.xy(6, 5, CC.CENTER, CC.BOTTOM));

                //---- lblUhrzeit7 ----
                lblUhrzeit7.setText("samstags");
                lblUhrzeit7.setOrientation(1);
                lblUhrzeit7.setFont(new Font("Arial", Font.PLAIN, 14));
                lblUhrzeit7.setClockwise(false);
                lblUhrzeit7.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblUhrzeit7, CC.xy(7, 5, CC.CENTER, CC.BOTTOM));

                //---- lblUhrzeit8 ----
                lblUhrzeit8.setText("sonntags");
                lblUhrzeit8.setOrientation(1);
                lblUhrzeit8.setFont(new Font("Arial", Font.PLAIN, 14));
                lblUhrzeit8.setClockwise(false);
                lblUhrzeit8.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblUhrzeit8, CC.xy(8, 5, CC.CENTER, CC.BOTTOM));

                //---- cbMon ----
                cbMon.setBorder(BorderFactory.createEmptyBorder());
                cbMon.setMargin(new Insets(0, 0, 0, 0));
                cbMon.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbMonActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbMon, CC.xy(2, 7, CC.CENTER, CC.DEFAULT));

                //---- cbDie ----
                cbDie.setBorder(BorderFactory.createEmptyBorder());
                cbDie.setMargin(new Insets(0, 0, 0, 0));
                cbDie.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbDieActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbDie, CC.xy(3, 7, CC.CENTER, CC.DEFAULT));

                //---- cbMit ----
                cbMit.setBorder(BorderFactory.createEmptyBorder());
                cbMit.setMargin(new Insets(0, 0, 0, 0));
                cbMit.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbMitActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbMit, CC.xy(4, 7, CC.CENTER, CC.DEFAULT));

                //---- cbDon ----
                cbDon.setBorder(BorderFactory.createEmptyBorder());
                cbDon.setMargin(new Insets(0, 0, 0, 0));
                cbDon.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbDonActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbDon, CC.xy(5, 7, CC.CENTER, CC.DEFAULT));

                //---- cbFre ----
                cbFre.setBorder(BorderFactory.createEmptyBorder());
                cbFre.setMargin(new Insets(0, 0, 0, 0));
                cbFre.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbFreActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbFre, CC.xy(6, 7, CC.CENTER, CC.DEFAULT));

                //---- cbSam ----
                cbSam.setBorder(BorderFactory.createEmptyBorder());
                cbSam.setMargin(new Insets(0, 0, 0, 0));
                cbSam.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbSamActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbSam, CC.xy(7, 7, CC.CENTER, CC.DEFAULT));

                //---- cbSon ----
                cbSon.setBorder(BorderFactory.createEmptyBorder());
                cbSon.setMargin(new Insets(0, 0, 0, 0));
                cbSon.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbSonActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbSon, CC.xy(8, 7, CC.CENTER, CC.DEFAULT));
            }
            tabWdh.addTab("W\u00f6chentlich", pnlWeekly);

            //======== pnlMonthly ========
            {
                pnlMonthly.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlMonthly.setLayout(
                        new FormLayout("default, $lcgap, pref, $lcgap, 40dlu, $lcgap, pref, $lcgap, 61dlu",
                                "3*(default, $lgap), default"));

                //---- lblEveryMonth ----
                lblEveryMonth.setText("jeden");
                lblEveryMonth.setFont(new Font("Arial", Font.PLAIN, 14));
                lblEveryMonth.setHorizontalAlignment(SwingConstants.TRAILING);
                pnlMonthly.add(lblEveryMonth, CC.xy(3, 3));

                //---- spinMonat ----
                spinMonat.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlMonthly.add(spinMonat, CC.xy(5, 3));

                //---- lblMonth ----
                lblMonth.setText("Monat");
                lblMonth.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlMonthly.add(lblMonth, CC.xy(7, 3));

                //---- btnJedenMonat ----
                btnJedenMonat.setText("Jeden Monat");
                btnJedenMonat.setFont(new Font("Arial", Font.PLAIN, 14));
                btnJedenMonat.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        btnJedenMonatActionPerformed(e);
                    }
                });
                pnlMonthly.add(btnJedenMonat, CC.xywh(3, 5, 5, 1));

                //---- llblOnDayOfMonth ----
                llblOnDayOfMonth.setText("jeweils am");
                llblOnDayOfMonth.setFont(new Font("Arial", Font.PLAIN, 14));
                llblOnDayOfMonth.setHorizontalAlignment(SwingConstants.TRAILING);
                pnlMonthly.add(llblOnDayOfMonth, CC.xy(3, 7));

                //---- spinDayInMonth ----
                spinDayInMonth.setFont(new Font("Arial", Font.PLAIN, 14));
                spinDayInMonth.addChangeListener(new ChangeListener() {
                    @Override
                    public void stateChanged(ChangeEvent e) {
                        spinMonatTagStateChanged(e);
                    }
                });
                pnlMonthly.add(spinDayInMonth, CC.xy(5, 7));

                //---- cmbTag ----
                cmbTag.setModel(new DefaultComboBoxModel<>(new String[] { "Tag des Monats", "Montag",
                        "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag" }));
                cmbTag.setFont(new Font("Arial", Font.PLAIN, 14));
                cmbTag.addItemListener(new ItemListener() {
                    @Override
                    public void itemStateChanged(ItemEvent e) {
                        cmbTagItemStateChanged(e);
                    }
                });
                pnlMonthly.add(cmbTag, CC.xywh(7, 7, 3, 1));
            }
            tabWdh.addTab("Monatlich", pnlMonthly);

            //======== pnlYearly ========
            {
                pnlYearly.setLayout(new FormLayout("30dlu, $rgap, 26dlu, $rgap, pref, $ugap, default",
                        "default, 15dlu, default"));

                //---- lblEveryYear ----
                lblEveryYear.setText("alle");
                lblEveryYear.setFont(new Font("Arial", Font.PLAIN, 14));
                lblEveryYear.setHorizontalAlignment(SwingConstants.TRAILING);
                pnlYearly.add(lblEveryYear, CC.xy(1, 1));

                //---- spinYearly ----
                spinYearly.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlYearly.add(spinYearly, CC.xy(3, 1));

                //---- lblYear ----
                lblYear.setText("Jahre");
                lblYear.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlYearly.add(lblYear, CC.xy(5, 1));

                //---- btnEveryYear ----
                btnEveryYear.setText("jedes Jahr");
                btnEveryYear.setFont(new Font("Arial", Font.PLAIN, 14));
                btnEveryYear.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        btnEveryYearActionPerformed(e);
                    }
                });
                pnlYearly.add(btnEveryYear, CC.xy(7, 1));

                //---- lblOnDay ----
                lblOnDay.setText("alle");
                lblOnDay.setFont(new Font("Arial", Font.PLAIN, 14));
                lblOnDay.setHorizontalAlignment(SwingConstants.TRAILING);
                pnlYearly.add(lblOnDay, CC.xy(1, 3));

                //---- spinDayInMonthInYear ----
                spinDayInMonthInYear.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlYearly.add(spinDayInMonthInYear, CC.xy(3, 3));
                pnlYearly.add(cmbMonth, CC.xywh(5, 3, 3, 1));
            }
            tabWdh.addTab("text", pnlYearly);
        }
        panelMain.add(tabWdh, CC.xywh(3, 11, 3, 1, CC.FILL, CC.FILL));

        //---- lblLDate ----
        lblLDate.setText("text");
        lblLDate.setFont(new Font("Arial", Font.PLAIN, 10));
        lblLDate.setHorizontalAlignment(SwingConstants.TRAILING);
        panelMain.add(lblLDate, CC.xy(5, 13));
        panelMain.add(jdcStartingOn, CC.xywh(3, 15, 3, 1));

        //======== jScrollPane1 ========
        {

            //---- txtBemerkung ----
            txtBemerkung.setColumns(20);
            txtBemerkung.setRows(5);
            txtBemerkung.setFont(new Font("Arial", Font.PLAIN, 14));
            txtBemerkung.setLineWrap(true);
            txtBemerkung.setWrapStyleWord(true);
            jScrollPane1.setViewportView(txtBemerkung);
        }
        panelMain.add(jScrollPane1, CC.xywh(3, 17, 3, 1, CC.DEFAULT, CC.FILL));

        //---- btnSave ----
        btnSave.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/apply.png")));
        btnSave.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                btnSaveActionPerformed(e);
            }
        });
        panelMain.add(btnSave, CC.xy(5, 19, CC.RIGHT, CC.DEFAULT));

        //---- lblDueDays ----
        lblDueDays.setText("text");
        lblDueDays.setFont(new Font("Arial", Font.PLAIN, 10));
        lblDueDays.setHorizontalAlignment(SwingConstants.TRAILING);
        panelMain.add(lblDueDays, CC.xy(3, 5));

        //---- txtDueDays ----
        txtDueDays.setFont(new Font("Arial", Font.PLAIN, 14));
        panelMain.add(txtDueDays, CC.xy(3, 7, CC.DEFAULT, CC.FILL));
    }
    add(panelMain, BorderLayout.CENTER);

    //---- buttonGroup1 ----
    ButtonGroup buttonGroup1 = new ButtonGroup();
    buttonGroup1.add(cbMon);
    buttonGroup1.add(cbDie);
    buttonGroup1.add(cbMit);
    buttonGroup1.add(cbDon);
    buttonGroup1.add(cbFre);
    buttonGroup1.add(cbSam);
    buttonGroup1.add(cbSon);
}

From source file:op.users.PnlUser.java

private java.util.List<Component> addFilters() {
    java.util.List<Component> list = new ArrayList<Component>();

    /***/*from  www . j  av a  2s. c  om*/
     *      _   _      ___  _     _ _   _
     *     | |_| |__  / _ \| | __| | | | |___  ___ _ __ ___
     *     | __| '_ \| | | | |/ _` | | | / __|/ _ \ '__/ __|
     *     | |_| |_) | |_| | | (_| | |_| \__ \  __/ |  \__ \
     *      \__|_.__/ \___/|_|\__,_|\___/|___/\___|_|  |___/
     *
     */
    tbOldUsers = GUITools.getNiceToggleButton(SYSTools.xx("opde.users.showclosedmembers"));
    tbOldUsers.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent itemEvent) {
            if (initPhase)
                return;
            buildPanel();
        }
    });
    tbOldUsers.setHorizontalAlignment(SwingConstants.LEFT);
    list.add(tbOldUsers);

    return list;
}

From source file:org.apache.cayenne.modeler.editor.ObjEntityTab.java

private void initView() {
    this.setLayout(new BorderLayout());

    JToolBar toolBar = new JToolBar();
    ActionManager actionManager = Application.getInstance().getActionManager();

    toolBar.add(actionManager.getAction(ObjEntitySyncAction.class).buildButton());
    toolBar.add(actionManager.getAction(CreateAttributeAction.class).buildButton());
    toolBar.add(actionManager.getAction(CreateRelationshipAction.class).buildButton());
    toolBar.addSeparator();/*  w w  w . j  a  v a 2 s . c  o m*/
    toolBar.add(actionManager.getAction(ShowGraphEntityAction.class).buildButton());
    toolBar.add(actionManager.getAction(ObjEntityCounterpartAction.class).buildButton());
    add(toolBar, BorderLayout.NORTH);

    // create widgets
    name = new TextAdapter(new JTextField()) {

        @Override
        protected void updateModel(String text) {
            setEntityName(text);
        }
    };
    superClassName = new TextAdapter(new JTextField()) {

        @Override
        protected void updateModel(String text) {
            setSuperClassName(text);
        }
    };
    className = new TextAdapter(new JTextField()) {

        @Override
        protected void updateModel(String text) {
            setClassName(text);
        }
    };
    qualifier = new TextAdapter(new JTextField()) {

        @Override
        protected void updateModel(String text) {
            setQualifier(text);
        }
    };

    dbEntityCombo = Application.getWidgetFactory().createComboBox();
    superEntityCombo = Application.getWidgetFactory().createComboBox();

    AutoCompletion.enable(dbEntityCombo);
    AutoCompletion.enable(superEntityCombo);

    readOnly = new JCheckBox();
    optimisticLocking = new JCheckBox();
    excludeSuperclassListeners = new JCheckBox();
    excludeDefaultListeners = new JCheckBox();

    // borderless clickable button used as a label
    tableLabel = new JButton("Table/View:");
    tableLabel.setBorderPainted(false);
    tableLabel.setHorizontalAlignment(SwingConstants.LEFT);
    tableLabel.setFocusPainted(false);
    tableLabel.setMargin(new Insets(0, 0, 0, 0));
    tableLabel.setBorder(null);

    isAbstract = new JCheckBox();
    serverOnly = new JCheckBox();
    clientClassName = new TextAdapter(new JTextField()) {

        @Override
        protected void updateModel(String text) {
            setClientClassName(text);
        }
    };
    clientSuperClassName = new TextAdapter(new JTextField()) {

        @Override
        protected void updateModel(String text) {
            setClientSuperClassName(text);
        }
    };

    // assemble
    FormLayout layout = new FormLayout("right:pref, 3dlu, fill:200dlu", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();

    builder.appendSeparator("ObjEntity Configuration");
    builder.append("ObjEntity Name:", name.getComponent());
    builder.append("Inheritance:", superEntityCombo);
    builder.append(tableLabel, dbEntityCombo);
    isAbstractLabel = builder.append("Abstract class:", isAbstract);
    builder.appendSeparator();

    builder.append("Java Class:", className.getComponent());

    superclassLabel = builder.append("Superclass:", superClassName.getComponent());
    builder.append("Qualifier:", qualifier.getComponent());
    builder.append("Read-Only:", readOnly);
    builder.append("Optimistic Locking:", optimisticLocking);
    // add callback-related stuff
    builder.append("Exclude superclass listeners:", excludeSuperclassListeners);
    builder.append("Exclude default listeners:", excludeDefaultListeners);

    clientSeparator = builder.appendSeparator("Java Client");
    serverOnlyLabel = builder.append("Not for Client Use:", serverOnly);
    clientClassNameLabel = builder.append("Client Java Class:", clientClassName.getComponent());
    clientSuperClassNameLabel = builder.append("Client Superclass:", clientSuperClassName.getComponent());

    add(builder.getPanel(), BorderLayout.CENTER);
}

From source file:org.datacleaner.windows.AnalysisJobBuilderWindowImpl.java

private void applyMenuPopupButttonStyling(PopupButton popupButton) {
    popupButton.setBorder(new EmptyBorder(10, 4, 10, 4));
    popupButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    popupButton.setFocusPainted(false);/*from  w w  w . ja v  a2s  . c om*/
    WidgetUtils.setDarkButtonStyle(popupButton);
    popupButton.setHorizontalTextPosition(SwingConstants.LEFT);
}

From source file:org.datacleaner.windows.ResultWindow.java

/**
 *
 * @param configuration//from ww  w . ja  v  a2  s  .c o m
 * @param job
 *            either this or result must be available
 * @param result
 *            either this or job must be available
 * @param jobFilename
 * @param windowContext
 * @param userPreferences
 * @param rendererFactory
 */
@Inject
protected ResultWindow(DataCleanerConfiguration configuration, @Nullable AnalysisJob job,
        @Nullable AnalysisResult result, @Nullable @JobFile FileObject jobFilename, WindowContext windowContext,
        UserPreferences userPreferences, RendererFactory rendererFactory) {
    super(windowContext);
    final boolean running = (result == null);

    _resultPanels = new IdentityHashMap<>();
    _configuration = configuration;
    _job = job;
    _jobFilename = jobFilename;
    _userPreferences = userPreferences;
    _rendererFactory = rendererFactory;

    final Ref<AnalysisResult> resultRef = new Ref<AnalysisResult>() {
        @Override
        public AnalysisResult get() {
            return getResult();
        }
    };

    Border buttonBorder = new CompoundBorder(WidgetUtils.BORDER_LIST_ITEM_SUBTLE,
            new EmptyBorder(10, 4, 10, 4));
    _cancelButton = WidgetFactory.createDefaultButton("Cancel job", IconUtils.ACTION_STOP);
    _cancelButton.setHorizontalAlignment(SwingConstants.LEFT);
    _cancelButton.setBorder(buttonBorder);

    _saveResultsPopupButton = WidgetFactory.createDefaultPopupButton("Save results",
            IconUtils.ACTION_SAVE_DARK);
    _saveResultsPopupButton.setHorizontalAlignment(SwingConstants.LEFT);
    _saveResultsPopupButton.setBorder(buttonBorder);
    _saveResultsPopupButton.setMenuPosition(MenuPosition.TOP);
    _saveResultsPopupButton.getMenu().setBorder(new MatteBorder(1, 0, 0, 1, WidgetUtils.BG_COLOR_MEDIUM));

    JMenuItem saveAsFileItem = WidgetFactory.createMenuItem("Save as result file", IconUtils.ACTION_SAVE_DARK);
    saveAsFileItem.addActionListener(new SaveAnalysisResultActionListener(resultRef, _userPreferences));
    saveAsFileItem.setBorder(buttonBorder);
    _saveResultsPopupButton.getMenu().add(saveAsFileItem);

    JMenuItem exportToHtmlItem = WidgetFactory.createMenuItem("Export to HTML", IconUtils.WEBSITE);
    exportToHtmlItem.addActionListener(
            new ExportResultToHtmlActionListener(resultRef, _configuration, _userPreferences));
    exportToHtmlItem.setBorder(buttonBorder);
    _saveResultsPopupButton.getMenu().add(exportToHtmlItem);

    JMenuItem publishToServerItem = WidgetFactory.createMenuItem("Publish to server",
            IconUtils.MENU_DQ_MONITOR);
    publishToServerItem.addActionListener(new PublishResultToMonitorActionListener(getWindowContext(),
            _userPreferences, resultRef, _jobFilename));
    publishToServerItem.setBorder(buttonBorder);
    _saveResultsPopupButton.getMenu().add(publishToServerItem);

    _tabbedPane = new VerticalTabbedPane() {
        private static final long serialVersionUID = 1L;

        @Override
        protected JComponent wrapInCollapsiblePane(final JComponent originalPanel) {
            DCPanel buttonPanel = new DCPanel();
            buttonPanel.setLayout(new VerticalLayout());
            buttonPanel.setBorder(new MatteBorder(1, 0, 0, 0, WidgetUtils.BG_COLOR_MEDIUM));

            buttonPanel.add(_saveResultsPopupButton);
            buttonPanel.add(_cancelButton);

            DCPanel wrappedPanel = new DCPanel();
            wrappedPanel.setLayout(new BorderLayout());
            wrappedPanel.add(originalPanel, BorderLayout.CENTER);
            wrappedPanel.add(buttonPanel, BorderLayout.SOUTH);
            return super.wrapInCollapsiblePane(wrappedPanel);
        }
    };

    final Dimension size = getDefaultWindowSize();
    _windowSizePreference = new WindowSizePreferences(_userPreferences, getClass(), size.width, size.height);
    _progressInformationPanel = new ProgressInformationPanel(running);
    _tabbedPane.addTab("Progress information",
            imageManager.getImageIcon("images/model/progress_information.png", IconUtils.ICON_SIZE_TAB),
            _progressInformationPanel);

    for (Func<ResultWindow, JComponent> pluggableComponent : PLUGGABLE_BANNER_COMPONENTS) {
        JComponent component = pluggableComponent.eval(this);
        if (component != null) {
            if (component instanceof AbstractButton) {
                AbstractButton button = (AbstractButton) component;
                JMenuItem menuItem = WidgetFactory.createMenuItem(button.getText(), button.getIcon());
                for (ActionListener listener : button.getActionListeners()) {
                    menuItem.addActionListener(listener);
                }
                menuItem.setBorder(buttonBorder);
                _saveResultsPopupButton.getMenu().add(menuItem);
            } else if (component instanceof JMenuItem) { // TODO: Not possible. JMenuItem is a subclass of AbstractButton. Reorder or remove?
                JMenuItem menuItem = (JMenuItem) component;
                menuItem.setBorder(buttonBorder);
                _saveResultsPopupButton.getMenu().add(menuItem);
            }
        }
    }

    if (running) {
        // run the job in a swing worker
        _result = null;
        _worker = new AnalysisRunnerSwingWorker(_configuration, _job, this);

        _cancelButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                _worker.cancelIfRunning();
            }
        });
    } else {
        // don't add the progress information, simply render the job asap
        _result = result;
        _worker = null;

        final Map<ComponentJob, AnalyzerResult> map = result.getResultMap();
        for (Entry<ComponentJob, AnalyzerResult> entry : map.entrySet()) {
            final ComponentJob componentJob = entry.getKey();
            final AnalyzerResult analyzerResult = entry.getValue();

            addResult(componentJob, analyzerResult);
        }
        _progressInformationPanel.onSuccess();

        WidgetUtils.invokeSwingAction(new Runnable() {
            @Override
            public void run() {
                if (_tabbedPane.getTabCount() > 1) {
                    // switch to the first available result panel
                    _tabbedPane.setSelectedIndex(1);
                }
            }
        });
    }

    updateButtonVisibility(running);
}

From source file:org.drugis.addis.gui.WelcomeDialog.java

private JButton createButton(String text, String icon, AbstractAction action) {
    JButton button = new JButton(text, Main.IMAGELOADER.getIcon(icon));
    button.setPreferredSize(new Dimension(BUTTON_WIDTH, COMP_HEIGHT));
    button.setHorizontalAlignment(SwingConstants.LEFT);
    button.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    button.addActionListener(action);//  w  w w. j a v  a2 s .  co  m
    return button;
}

From source file:org.eclipse.wb.tests.designer.core.model.property.editor.StaticFieldPropertyEditorTest.java

/**
 * Top level class, all fields are valid.
 */// ww  w . j a v  a2 s  . co  m
public void test_configure_1() throws Exception {
    StaticFieldPropertyEditor editor = new StaticFieldPropertyEditor();
    editor.configure(SwingConstants.class, new String[] { "LEFT", "RIGHT" });
    //
    Class<?> e_class = SwingConstants.class;
    String m_classSourceName = "javax.swing.SwingConstants";
    Object[] e_names = new String[] { "LEFT", "RIGHT" };
    Object[] e_titles = new String[] { "LEFT", "RIGHT" };
    Object[] e_values = new Object[] { SwingConstants.LEFT, SwingConstants.RIGHT };
    assertConfiguration(editor, e_class, m_classSourceName, e_names, e_titles, e_values);
}

From source file:org.eclipse.wb.tests.designer.core.model.property.editor.StaticFieldPropertyEditorTest.java

/**
 * Top level class, one field does not exist, should be skipped.
 *///from   w  w w  .j  a va2  s . c  o m
public void test_configure_2() throws Exception {
    StaticFieldPropertyEditor editor = new StaticFieldPropertyEditor();
    editor.configure(SwingConstants.class, new String[] { "LEFT", "noSuchField", "RIGHT" });
    //
    Class<?> e_class = SwingConstants.class;
    String m_classSourceName = "javax.swing.SwingConstants";
    Object[] e_names = new String[] { "LEFT", "RIGHT" };
    Object[] e_titles = new String[] { "LEFT", "RIGHT" };
    Object[] e_values = new Object[] { SwingConstants.LEFT, SwingConstants.RIGHT };
    assertConfiguration(editor, e_class, m_classSourceName, e_names, e_titles, e_values);
}

From source file:org.eclipse.wb.tests.designer.core.model.property.editor.StaticFieldPropertyEditorTest.java

/**
 * Top level class, all fields are valid. Specify title in field description.
 *///www  .  j  a v  a2s . c om
public void test_configure_3() throws Exception {
    StaticFieldPropertyEditor editor = new StaticFieldPropertyEditor();
    editor.configure(SwingConstants.class, new String[] { "LEFT:asLeft", "RIGHT:asRight" });
    //
    Class<?> e_class = SwingConstants.class;
    String m_classSourceName = "javax.swing.SwingConstants";
    Object[] e_names = new String[] { "LEFT", "RIGHT" };
    Object[] e_titles = new String[] { "asLeft", "asRight" };
    Object[] e_values = new Object[] { SwingConstants.LEFT, SwingConstants.RIGHT };
    assertConfiguration(editor, e_class, m_classSourceName, e_names, e_titles, e_values);
}

From source file:org.eclipse.wb.tests.designer.core.model.property.editor.StaticFieldPropertyEditorTest.java

/**
 * Special <code>*remove</code> field.
 *//*w  ww .java  2s .c om*/
public void test_configure_4() throws Exception {
    StaticFieldPropertyEditor editor = new StaticFieldPropertyEditor();
    editor.configure(SwingConstants.class, new String[] { "LEFT", "*remove", "RIGHT" });
    //
    Class<?> e_class = SwingConstants.class;
    String m_classSourceName = "javax.swing.SwingConstants";
    Object[] e_names = new String[] { "LEFT", null, "RIGHT" };
    Object[] e_titles = new String[] { "LEFT", "", "RIGHT" };
    Object[] e_values = new Object[] { SwingConstants.LEFT, null, SwingConstants.RIGHT };
    assertConfiguration(editor, e_class, m_classSourceName, e_names, e_titles, e_values);
}