Example usage for javax.swing SwingConstants RIGHT

List of usage examples for javax.swing SwingConstants RIGHT

Introduction

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

Prototype

int RIGHT

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

Click Source Link

Document

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

Usage

From source file:com.floreantpos.ui.views.payment.GroupSettleTicketDialog.java

private JPanel createTotalViewerPanel() {

    JLabel lblSubtotal = new javax.swing.JLabel();
    lblSubtotal.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
    lblSubtotal.setText(com.floreantpos.POSConstants.SUBTOTAL + ":" + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$ //$NON-NLS-2$

    tfSubtotal = new javax.swing.JTextField(10);
    tfSubtotal.setHorizontalAlignment(SwingConstants.TRAILING);
    tfSubtotal.setEditable(false);/* w ww.j a  v a2 s. co  m*/

    JLabel lblDiscount = new javax.swing.JLabel();
    lblDiscount.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
    lblDiscount.setText(Messages.getString("TicketView.9") + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$ //$NON-NLS-2$

    tfDiscount = new javax.swing.JTextField(10);
    tfDiscount.setHorizontalAlignment(SwingConstants.TRAILING);
    tfDiscount.setEditable(false);

    JLabel lblDeliveryCharge = new javax.swing.JLabel();
    lblDeliveryCharge.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
    lblDeliveryCharge.setText("Delivery Charge:" + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$ //$NON-NLS-2$

    tfDeliveryCharge = new JTextField(10);
    tfDeliveryCharge.setHorizontalAlignment(SwingConstants.TRAILING);
    tfDeliveryCharge.setEditable(false);

    JLabel lblTax = new javax.swing.JLabel();
    lblTax.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
    lblTax.setText(com.floreantpos.POSConstants.TAX + ":" + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$ //$NON-NLS-2$

    tfTax = new javax.swing.JTextField();
    tfTax.setEditable(false);
    tfTax.setHorizontalAlignment(SwingConstants.TRAILING);

    JLabel lblGratuity = new javax.swing.JLabel();
    lblGratuity.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
    lblGratuity
            .setText(Messages.getString("SettleTicketDialog.5") + ":" + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$

    tfGratuity = new javax.swing.JTextField();
    tfGratuity.setEditable(false);
    tfGratuity.setHorizontalAlignment(SwingConstants.TRAILING);

    JLabel lblTotal = new javax.swing.JLabel();
    lblTotal.setFont(lblTotal.getFont().deriveFont(Font.BOLD, 18));
    lblTotal.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
    lblTotal.setText(com.floreantpos.POSConstants.TOTAL + ":" + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$ //$NON-NLS-2$

    tfTotal = new javax.swing.JTextField(10);
    tfTotal.setFont(tfTotal.getFont().deriveFont(Font.BOLD, 18));
    tfTotal.setHorizontalAlignment(SwingConstants.TRAILING);
    tfTotal.setEditable(false);

    JPanel ticketAmountPanel = new com.floreantpos.swing.TransparentPanel(
            new MigLayout("hidemode 3,ins 2 2 3 2,alignx trailing,fill", "[grow][]", "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    ticketAmountPanel.add(lblSubtotal, "growx,aligny center"); //$NON-NLS-1$
    ticketAmountPanel.add(tfSubtotal, "growx,aligny center"); //$NON-NLS-1$
    ticketAmountPanel.add(lblDiscount, "newline,growx,aligny center"); //$NON-NLS-1$ //$NON-NLS-2$
    ticketAmountPanel.add(tfDiscount, "growx,aligny center"); //$NON-NLS-1$
    ticketAmountPanel.add(lblTax, "newline,growx,aligny center"); //$NON-NLS-1$
    ticketAmountPanel.add(tfTax, "growx,aligny center"); //$NON-NLS-1$
    ticketAmountPanel.add(lblDeliveryCharge, "newline,growx,aligny center"); //$NON-NLS-1$
    ticketAmountPanel.add(tfDeliveryCharge, "growx,aligny center"); //$NON-NLS-1$
    ticketAmountPanel.add(lblGratuity, "newline,growx,aligny center"); //$NON-NLS-1$
    ticketAmountPanel.add(tfGratuity, "growx,aligny center"); //$NON-NLS-1$
    ticketAmountPanel.add(lblTotal, "newline,growx,aligny center"); //$NON-NLS-1$
    ticketAmountPanel.add(tfTotal, "growx,aligny center"); //$NON-NLS-1$

    return ticketAmountPanel;
}

From source file:Classes.MainForm.java

private void initMainForm() throws IOException {//create sally form
    switch (getPrayerTimesHandler().getActualPrayerTime()) {//set background
    case 0:/*from   w ww . jav a 2s. co m*/
        this.backgroundImage = new ImageIcon(getClass().getResource(duhrBackground)).getImage();
        break;
    case 1:
        this.backgroundImage = new ImageIcon(getClass().getResource(shorou9Background)).getImage();
        break;
    case 2:
        this.backgroundImage = new ImageIcon(getClass().getResource(fajrBackground)).getImage();
        break;
    case 3:
        this.backgroundImage = new ImageIcon(getClass().getResource(ishaaBackground)).getImage();
        break;
    case 4:
        this.backgroundImage = new ImageIcon(getClass().getResource(maghribBackground)).getImage();
        break;
    case 5:
        this.backgroundImage = new ImageIcon(getClass().getResource(asrBackground)).getImage();
        break;
    default:
        this.backgroundImage = new ImageIcon(getClass().getResource(shorou9Background)).getImage();
        break;
    }
    this.mainFrame = new JFrame();
    this.mainPanel = new MainImagePanel(getBackgroundImage(), prayerTimesHandler.getActualPrayerTime());
    this.mainPanel.setLayout(null);
    this.font = new Font("TimesRoman", Font.ITALIC, 15);
    this.locationFont = new Font("TimesRoman", Font.ITALIC, 22);
    this.digitalClockfont = new Font("TimesRoman", Font.ROMAN_BASELINE, 20);
    this.fontMiladiHijriTimes = new Font("TimesRoman", Font.ROMAN_BASELINE, 13);
    this.fontNextPrayer = new Font("TimesRoman", Font.ROMAN_BASELINE, 20);
    this.exitLabel = new JLabel();
    this.hijriTime = new JLabel("", SwingConstants.RIGHT);
    this.miladiTime = new JLabel();
    this.location = new JLabel(locationValue);
    this.location.setHorizontalAlignment(SwingConstants.CENTER);
    this.locationFromInternet = new JLabel();

    //get all translated salat names
    this.fajrName = new JLabel(PropertiesHandler.getSingleton().getValue(1020));
    this.fajrName.setHorizontalAlignment(SwingConstants.CENTER);
    this.fajrTime = new JLabel();
    this.fajrTime.setHorizontalAlignment(SwingConstants.CENTER);
    this.shorou9Name = new JLabel(PropertiesHandler.getSingleton().getValue(1021));
    this.shorou9Name.setHorizontalAlignment(SwingConstants.CENTER);
    this.shorou9Time = new JLabel();
    this.shorou9Time.setHorizontalAlignment(SwingConstants.CENTER);
    this.duhrName = new JLabel(PropertiesHandler.getSingleton().getValue(1022));
    this.duhrName.setHorizontalAlignment(SwingConstants.CENTER);
    this.duhrTime = new JLabel();
    this.duhrTime.setHorizontalAlignment(SwingConstants.CENTER);
    this.asrName = new JLabel(PropertiesHandler.getSingleton().getValue(1023));
    this.asrName.setHorizontalAlignment(SwingConstants.CENTER);
    this.asrTime = new JLabel();
    this.asrTime.setHorizontalAlignment(SwingConstants.CENTER);
    this.maghribName = new JLabel(PropertiesHandler.getSingleton().getValue(1024));
    this.maghribName.setHorizontalAlignment(SwingConstants.CENTER);
    this.maghribTime = new JLabel();
    this.maghribTime.setHorizontalAlignment(SwingConstants.CENTER);
    this.ishaaName = new JLabel(PropertiesHandler.getSingleton().getValue(1025));
    this.ishaaName.setHorizontalAlignment(SwingConstants.CENTER);
    this.ishaaTime = new JLabel();
    this.ishaaTime.setHorizontalAlignment(SwingConstants.CENTER);

    this.digitalClock = new JLabel();
    this.nextPrayer = new JLabel();

    this.settings = new JLabel();

    this.exitLabel.setIcon(exitIcon);
    this.settings.setIcon(settingsIcon);
    this.locationFromInternet.setIcon(locationfromInternetIconMain);

    this.nextDayPrayerTimes = new JLabel(new ImageIcon(getClass().getResource(nextDayPrayerTimesIcon)));
    this.previousDayPrayerTimes = new JLabel(new ImageIcon(getClass().getResource(previousDayPrayerTimesIcon)));
    this.actualDayPrayerTimes = new JLabel(new ImageIcon(getClass().getResource(actualDayPrayerTimesIcon)));

    this.previousDayPrayerTimes.setBounds(480, 275, 15, 15);
    this.actualDayPrayerTimes.setBounds(500, 275, 15, 15);
    this.nextDayPrayerTimes.setBounds(520, 275, 15, 15);

    this.nextDayPrayerTimes.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            nextPreviousDay++;
            Calendar cal = Calendar.getInstance();
            cal.add(Calendar.DATE, nextPreviousDay);
            try {
                PrayersTimes prayerTimes = new PrayersTimes(cal);
                MiladiTime miladiTime = new MiladiTime(cal);
                HijriTime hijriTime = new HijriTime(cal);
                setAllLabelsTimesHijriMiladiValues2(prayerTimes, hijriTime, miladiTime);
            } catch (IOException e1) {
            }
        }
    });
    this.previousDayPrayerTimes.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            nextPreviousDay--;
            Calendar cal = Calendar.getInstance();
            cal.add(Calendar.DATE, nextPreviousDay);
            try {
                PrayersTimes prayerTimes = new PrayersTimes(cal);
                MiladiTime miladiTime = new MiladiTime(cal);
                HijriTime hijriTime = new HijriTime(cal);
                setAllLabelsTimesHijriMiladiValues2(prayerTimes, hijriTime, miladiTime);
            } catch (IOException e1) {
            }
        }
    });
    this.actualDayPrayerTimes.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            try {
                nextPreviousDay = 0;
                setAllLabelsTimesHijriMiladiValues(prayersTimes, hijriTimeObj, miladiTimeObj);
            } catch (IOException e1) {
            } //set all values to all labels
        }
    });

    //set foreground color to all salat names and times
    this.duhrName.setForeground(Color.WHITE);
    this.shorou9Name.setForeground(Color.WHITE);
    this.fajrName.setForeground(Color.WHITE);
    this.ishaaName.setForeground(Color.WHITE);
    this.maghribName.setForeground(Color.WHITE);
    this.asrName.setForeground(Color.WHITE);

    this.duhrTime.setForeground(Color.WHITE);
    this.shorou9Time.setForeground(Color.WHITE);
    this.fajrTime.setForeground(Color.WHITE);
    this.ishaaTime.setForeground(Color.WHITE);
    this.maghribTime.setForeground(Color.WHITE);
    this.asrTime.setForeground(Color.WHITE);
    this.miladiTime.setForeground(Color.WHITE);
    this.hijriTime.setForeground(Color.WHITE);
    this.location.setForeground(Color.WHITE);
    this.digitalClock.setForeground(Color.WHITE);
    this.nextPrayer.setForeground(Color.WHITE);

    //set font to all salat names and times
    this.duhrName.setFont(font);
    this.shorou9Name.setFont(font);
    this.fajrName.setFont(font);
    this.ishaaName.setFont(font);
    this.maghribName.setFont(font);
    this.asrName.setFont(font);
    this.duhrTime.setFont(font);
    this.shorou9Time.setFont(font);
    this.fajrTime.setFont(font);
    this.ishaaTime.setFont(font);
    this.maghribTime.setFont(font);
    this.asrTime.setFont(font);
    this.digitalClock.setFont(digitalClockfont);
    this.nextPrayer.setFont(fontNextPrayer);
    this.miladiTime.setFont(fontMiladiHijriTimes);
    this.hijriTime.setFont(fontMiladiHijriTimes);
    this.location.setFont(locationFont);

    //set position color to all salat names and times
    this.exitLabel.setBounds(510, 0, 40, 40);
    if (UserConfig.getSingleton().getLanguage().equalsIgnoreCase(ar)) {
        this.hijriTime.setBounds(100, 3, 250, 20);
        this.miladiTime.setBounds(20, 3, 250, 20);
    } else {
        this.hijriTime.setBounds(150, 3, 250, 20);
        this.miladiTime.setBounds(5, 3, 250, 20);
    }
    this.location.setBounds(0, 40, 550, 30);

    this.donateLabel = new JLabel(PropertiesHandler.getSingleton().getValue(1106));
    this.donateLabel.setFont(fontMiladiHijriTimes);
    this.donateLabel.setBounds(420, 3, 50, 20);
    this.donateLabel.setForeground(Color.WHITE);
    this.donateLabel.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            String url = "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FJDAFTPKN2S2W";
            String os = System.getProperty("os.name").toLowerCase();
            Runtime rt = Runtime.getRuntime();

            try {

                if (os.indexOf("win") >= 0) {

                    // this doesn't support showing urls in the form of "page.html#nameLink" 
                    rt.exec("rundll32 url.dll,FileProtocolHandler " + url);

                } else if (os.indexOf("mac") >= 0) {

                    rt.exec("open " + url);

                } else if (os.indexOf("nix") >= 0 || os.indexOf("nux") >= 0) {

                    // Do a best guess on unix until we get a platform independent way
                    // Build a list of browsers to try, in this order.
                    String[] browsers = { "epiphany", "firefox", "mozilla", "konqueror", "netscape", "opera",
                            "links", "lynx" };

                    // Build a command string which looks like "browser1 "url" || browser2 "url" ||..."
                    StringBuffer cmd = new StringBuffer();
                    for (int i = 0; i < browsers.length; i++)
                        cmd.append((i == 0 ? "" : " || ") + browsers[i] + " \"" + url + "\" ");

                    rt.exec(new String[] { "sh", "-c", cmd.toString() });

                } else {
                }
            } catch (Exception ex) {
            }
        }
    });

    this.locationFromInternet.setBounds(260, 70, 20, 20);
    this.locationFromInternet.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(final MouseEvent e) {
            new Thread(new Runnable() {

                @Override
                public void run() {
                    if (locationFromInternet.isEnabled()) {
                        locationFromInternet.setEnabled(false);
                        locationFromInternet.setIcon(loaderMain);
                        locationFromInternetLabelMouseClicked(e);
                    }
                }
            }).start();
        }
    });

    this.fajrAthan = new JLabel();
    this.fajrAthan.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            try {
                allAthanClickHandler(0);
            } catch (Exception e1) {
            }
        }
    });
    this.shorou9Athan = new JLabel();
    this.shorou9Athan.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            try {
                allAthanClickHandler(1);
            } catch (Exception e1) {
            }
        }
    });
    this.duhrAthan = new JLabel();
    this.duhrAthan.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            try {
                allAthanClickHandler(2);
            } catch (Exception e1) {
            }
        }
    });
    this.asrAthan = new JLabel();
    this.asrAthan.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            try {
                allAthanClickHandler(3);
            } catch (Exception e1) {
            }
        }
    });
    this.maghribAthan = new JLabel();
    this.maghribAthan.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            try {
                allAthanClickHandler(4);
            } catch (Exception e1) {
            }
        }
    });
    this.ishaaAthan = new JLabel();
    this.ishaaAthan.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            try {
                allAthanClickHandler(5);
            } catch (Exception e1) {
            }
        }
    });

    this.duhrAthan.setBounds(152, 132, 28, 28);
    this.shorou9Athan.setBounds(322, 132, 28, 28);
    this.fajrAthan.setBounds(492, 132, 28, 28);
    this.ishaaAthan.setBounds(152, 212, 28, 28);
    this.maghribAthan.setBounds(322, 212, 28, 28);
    this.asrAthan.setBounds(492, 212, 28, 28);

    setAllAthanIcons();

    this.duhrName.setBounds(30, 100, 150, 30);
    this.duhrTime.setBounds(30, 130, 150, 30);
    this.shorou9Name.setBounds(200, 100, 150, 30);
    this.shorou9Time.setBounds(200, 130, 150, 30);
    this.fajrName.setBounds(370, 100, 150, 30);
    this.fajrTime.setBounds(370, 130, 150, 30);

    this.ishaaName.setBounds(30, 180, 150, 30);
    this.ishaaTime.setBounds(30, 210, 150, 30);
    this.maghribName.setBounds(200, 180, 150, 30);
    this.maghribTime.setBounds(200, 210, 150, 30);
    this.asrName.setBounds(370, 180, 150, 30);
    this.asrTime.setBounds(370, 210, 150, 30);

    this.digitalClock.setBounds(10, 250, 200, 50);
    this.nextPrayer.setBounds(150, 262, 350, 30);

    this.settings.setBounds(470, 0, 40, 40);
    this.settings.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            settingsLabelMouseClicked(e);
        }
    });

    this.exitLabel.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            exitLabelMouseClicked(e);
        }
    });
    this.mainFrame.addMouseMotionListener(new MouseAdapter() {
        @Override
        public void mouseDragged(MouseEvent e) {
            mainFrameMouseDragged(e);
        }
    });
    this.mainFrame.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent e) {
            mainFrameMousePressed(e);
        }
    });
    this.mainFrame.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent e) {
            mainFrameMouseReleased(e);
        }
    });

    this.mainFrame.setSize(550, 300);
    this.mainFrame.setLocationRelativeTo(null);
    this.mainFrame.setUndecorated(true);
    this.mainFrame.setResizable(false);

    //adding all labels objects to main panel
    this.mainPanel.add(exitLabel);
    this.mainPanel.add(hijriTime);
    this.mainPanel.add(miladiTime);
    this.mainPanel.add(location);
    this.mainPanel.add(locationFromInternet);

    this.mainPanel.add(duhrName);
    this.mainPanel.add(duhrTime);
    this.mainPanel.add(shorou9Name);
    this.mainPanel.add(shorou9Time);
    this.mainPanel.add(fajrName);
    this.mainPanel.add(fajrTime);
    this.mainPanel.add(ishaaName);
    this.mainPanel.add(ishaaTime);
    this.mainPanel.add(maghribName);
    this.mainPanel.add(maghribTime);
    this.mainPanel.add(asrName);
    this.mainPanel.add(asrTime);
    this.mainPanel.add(digitalClock);
    this.mainPanel.add(nextPrayer);
    this.mainPanel.add(settings);
    this.mainPanel.add(donateLabel);

    this.mainPanel.add(fajrAthan);
    this.mainPanel.add(shorou9Athan);
    this.mainPanel.add(duhrAthan);
    this.mainPanel.add(asrAthan);
    this.mainPanel.add(maghribAthan);
    this.mainPanel.add(ishaaAthan);

    this.mainPanel.add(nextDayPrayerTimes);
    this.mainPanel.add(previousDayPrayerTimes);
    this.mainPanel.add(actualDayPrayerTimes);

    this.mainFrame.add(mainPanel);
    this.pack();

    trayConfig();//create try icon

    this.setAllLabelsTimesHijriMiladiValues(prayersTimes, hijriTimeObj, miladiTimeObj);//set all values to all labels
    this.prayerTimesHandler.start();//start prayer times handler thread
}

From source file:com.tiempometa.muestradatos.JReadTags.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY
    // //GEN-BEGIN:initComponents
    ResourceBundle bundle = ResourceBundle.getBundle("com.tiempometa.muestradatos.muestradatos");
    dialogPane = new JPanel();
    contentPanel = new JPanel();
    label2 = new JLabel();
    nextBibTextField = new JTextField();
    statusLabel = new JLabel();
    startReadingButton = new JButton();
    bibLabel = new JLabel();
    scrollPane1 = new JScrollPane();
    tagReadTable = new JTable();
    label3 = new JLabel();
    tidTextField = new JTextField();
    deleteSelectedButton = new JButton();
    label4 = new JLabel();
    epcTextField = new JTextField();
    deleteReadButton = new JButton();
    label1 = new JLabel();
    dataToStoreComboBox = new JComboBox<>();
    deleteAllButton = new JButton();
    allowDuplicateBibsCheckBox = new JCheckBox();
    buttonBar = new JPanel();
    closeButton = new JButton();
    CellConstraints cc = new CellConstraints();

    //======== this ========
    setTitle(bundle.getString("JReadTags.this.title"));
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    setResizable(false);//from  w w  w  . j ava  2 s  .  c  om
    setIconImage(
            new ImageIcon(getClass().getResource("/com/tiempometa/resources/tiempometa_icon_large_alpha.png"))
                    .getImage());
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    //======== dialogPane ========
    {
        dialogPane.setBorder(Borders.DIALOG_BORDER);
        dialogPane.setLayout(new BorderLayout());

        //======== contentPanel ========
        {
            contentPanel.setLayout(new FormLayout(
                    new ColumnSpec[] { new ColumnSpec(Sizes.dluX(15)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(Sizes.dluX(52)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(Sizes.dluX(138)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(Sizes.dluX(71)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(Sizes.dluX(155)) },
                    new RowSpec[] { new RowSpec(Sizes.dluY(17)), FormFactory.LINE_GAP_ROWSPEC,
                            new RowSpec(Sizes.dluY(20)), FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            new RowSpec(Sizes.dluY(20)), FormFactory.LINE_GAP_ROWSPEC,
                            new RowSpec(Sizes.dluY(25)), FormFactory.LINE_GAP_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, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC }));

            //---- label2 ----
            label2.setText(bundle.getString("JReadTags.label2.text"));
            label2.setFont(new Font("Tahoma", Font.PLAIN, 36));
            contentPanel.add(label2, cc.xywh(3, 5, 3, 1));

            //---- nextBibTextField ----
            nextBibTextField.setFont(new Font("Tahoma", Font.PLAIN, 36));
            nextBibTextField.setHorizontalAlignment(SwingConstants.RIGHT);
            nextBibTextField.setText(bundle.getString("JReadTags.nextBibTextField.text"));
            contentPanel.add(nextBibTextField, cc.xy(7, 5));

            //---- statusLabel ----
            statusLabel.setText(bundle.getString("JReadTags.statusLabel.text"));
            statusLabel.setHorizontalAlignment(SwingConstants.CENTER);
            statusLabel.setBackground(Color.yellow);
            statusLabel.setOpaque(true);
            statusLabel.setFont(new Font("Tahoma", Font.BOLD, 20));
            contentPanel.add(statusLabel, cc.xywh(9, 3, 1, 5));

            //---- startReadingButton ----
            startReadingButton.setText(bundle.getString("JReadTags.startReadingButton.text"));
            startReadingButton.setFont(new Font("Tahoma", Font.PLAIN, 14));
            startReadingButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    startReadingButtonActionPerformed(e);
                }
            });
            contentPanel.add(startReadingButton, cc.xywh(3, 7, 3, 1));

            //---- bibLabel ----
            bibLabel.setForeground(Color.red);
            bibLabel.setFont(new Font("Tahoma", Font.BOLD, 36));
            bibLabel.setHorizontalAlignment(SwingConstants.CENTER);
            contentPanel.add(bibLabel, cc.xy(9, 9));

            //======== scrollPane1 ========
            {
                scrollPane1.setViewportView(tagReadTable);
            }
            contentPanel.add(scrollPane1, cc.xywh(3, 11, 7, 1));

            //---- label3 ----
            label3.setText(bundle.getString("JReadTags.label3.text"));
            label3.setHorizontalAlignment(SwingConstants.RIGHT);
            label3.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(label3, cc.xy(3, 13));

            //---- tidTextField ----
            tidTextField.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(tidTextField, cc.xy(5, 13));

            //---- deleteSelectedButton ----
            deleteSelectedButton.setText(bundle.getString("JReadTags.deleteSelectedButton.text"));
            deleteSelectedButton.setFont(new Font("Tahoma", Font.PLAIN, 14));
            deleteSelectedButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    deleteSelectedButtonActionPerformed(e);
                }
            });
            contentPanel.add(deleteSelectedButton, cc.xy(9, 13));

            //---- label4 ----
            label4.setText(bundle.getString("JReadTags.label4.text"));
            label4.setHorizontalAlignment(SwingConstants.RIGHT);
            label4.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(label4, cc.xy(3, 15));

            //---- epcTextField ----
            epcTextField.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(epcTextField, cc.xy(5, 15));

            //---- deleteReadButton ----
            deleteReadButton.setText(bundle.getString("JReadTags.deleteReadButton.text"));
            deleteReadButton.setFont(new Font("Tahoma", Font.PLAIN, 14));
            deleteReadButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    deleteReadButtonActionPerformed(e);
                }
            });
            contentPanel.add(deleteReadButton, cc.xy(9, 15));

            //---- label1 ----
            label1.setText(bundle.getString("JReadTags.label1.text"));
            label1.setHorizontalAlignment(SwingConstants.RIGHT);
            label1.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(label1, cc.xy(3, 17));

            //---- dataToStoreComboBox ----
            dataToStoreComboBox.setModel(new DefaultComboBoxModel<>(new String[] { "EPC", "TID" }));
            dataToStoreComboBox.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(dataToStoreComboBox, cc.xy(5, 17));

            //---- deleteAllButton ----
            deleteAllButton.setText(bundle.getString("JReadTags.deleteAllButton.text"));
            deleteAllButton.setFont(new Font("Tahoma", Font.PLAIN, 14));
            deleteAllButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    deleteAllButtonActionPerformed(e);
                }
            });
            contentPanel.add(deleteAllButton, cc.xy(9, 17));

            //---- allowDuplicateBibsCheckBox ----
            allowDuplicateBibsCheckBox.setText(bundle.getString("JReadTags.allowDuplicateBibsCheckBox.text"));
            contentPanel.add(allowDuplicateBibsCheckBox, cc.xy(5, 19));
        }
        dialogPane.add(contentPanel, BorderLayout.CENTER);

        //======== buttonBar ========
        {
            buttonBar.setBorder(Borders.BUTTON_BAR_GAP_BORDER);
            buttonBar.setLayout(
                    new FormLayout(new ColumnSpec[] { FormFactory.GLUE_COLSPEC, FormFactory.BUTTON_COLSPEC },
                            RowSpec.decodeSpecs("pref")));

            //---- closeButton ----
            closeButton.setText("Cerrar");
            closeButton.setFont(new Font("Tahoma", Font.PLAIN, 14));
            closeButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    closeButtonActionPerformed(e);
                }
            });
            buttonBar.add(closeButton, cc.xy(2, 1));
        }
        dialogPane.add(buttonBar, BorderLayout.SOUTH);
    }
    contentPane.add(dialogPane, BorderLayout.CENTER);
    setSize(710, 675);
    setLocationRelativeTo(getOwner());
    // //GEN-END:initComponents
}

From source file:edu.ku.brc.af.ui.weblink.WebLinkButton.java

/**
 * @return//from   www .j  a v a  2s . com
 */
private CustomDialog createPromptDlg(final Hashtable<String, String> backupHash) {
    if (webLinkDef != null) {
        // Start by getting the data needed to build the URL
        // so first see if we need to prompt for data.

        int promptCnt = webLinkDef.getPromptCount();
        if (promptCnt > 0 || backupHash.size() > 0) {
            textFieldHash.clear();

            promptCnt += backupHash != null ? backupHash.size() : 0;

            String rowDef = createDuplicateJGoodiesDef("p", "4px", promptCnt); //$NON-NLS-1$ //$NON-NLS-2$
            PanelBuilder pb = new PanelBuilder(new FormLayout("p,2px,f:p:g", rowDef)); //$NON-NLS-1$
            CellConstraints cc = new CellConstraints();

            DocumentAdaptor dla = new DocumentAdaptor() {
                @Override
                protected void changed(DocumentEvent e) {
                    super.changed(e);
                    boolean enableOK = true;
                    for (JTextField tf : textFieldHash.values()) {
                        if (tf.getText().length() == 0) {
                            enableOK = false;
                            break;
                        }
                    }
                    promptDialog.getOkBtn().setEnabled(enableOK);
                }

            };

            int y = 1;
            for (WebLinkDefArg arg : webLinkDef.getArgs()) {
                if (arg.isPrompt() && valueHash.get(arg.getName()) == null) {
                    JTextField txtField = createTextField(15);
                    txtField.getDocument().addDocumentListener(dla);
                    textFieldHash.put(arg.getName(), txtField);
                    String label = arg.getTitle();
                    if (StringUtils.isEmpty(label)) {
                        label = arg.getName();
                    }
                    pb.add(createFormLabel(label), cc.xy(1, y));
                    pb.add(txtField, cc.xy(3, y));
                    y += 2;
                }
            }

            if (backupHash != null) {
                for (String name : backupHash.keySet()) {
                    JTextField txtField = createTextField(15);
                    txtField.getDocument().addDocumentListener(dla);
                    textFieldHash.put(name, txtField);
                    pb.add(createLabel(backupHash.get(name), SwingConstants.RIGHT), cc.xy(1, y));
                    pb.add(txtField, cc.xy(3, y));
                    y += 2;
                }
            }

            pb.setDefaultDialogBorder();

            return new CustomDialog((Frame) getTopWindow(), getResourceString("WBLK_PROMPT_DATA"), true,
                    CustomDialog.OKCANCELHELP, pb.getPanel());
        }
    }
    return null;
}

From source file:edu.ku.brc.ui.tmanfe.SearchReplacePanel.java

/**
 * Creates the panel that displays the close button, the search field, the next button,
 * the previous button, the match case checkbox and the wrap search checkbox
 *///w w  w .  ja va  2 s.co m
private void createFindPanel() {
    cancelButton = createButton(hideFindPanelAction);
    cancelButton.setIcon(IconManager.getIcon("Close"));
    cancelButton.setMargin(new Insets(0, 0, 0, 0));
    cancelButton.setBorder(null);

    findLabel = createLabel(getResourceString("SS_SR_FIND") + ": ", SwingConstants.RIGHT);

    nextButton = createButton(getResourceString("SS_SR_NEXT"));//, new ImageIcon(Specify.class.getResource("images/down.png")));
    nextButton.setEnabled(false);
    UIHelper.setLocalizedMnemonic(previousButton, "SS_SR_NEXT_MNEU");
    nextButton.addActionListener(searchAction);

    previousButton = createButton(getResourceString("SS_SR_PREVIOUS"));//, new ImageIcon(Specify.class.getResource("images/up.png")));
    previousButton.setEnabled(false);
    UIHelper.setLocalizedMnemonic(previousButton, "SS_SR_PREVIOUS_MNEU");

    previousButton.addActionListener(searchAction);

    //JComponent[] itemSample = { new JMenuItem("Replace"), new JMenuItem("Replace All") };
    //replaceButton = new MemoryDropDownButton("Replace", IconManager.getIcon("DropDownArrow"),
    //                1, java.util.Arrays.asList(itemSample));
    //replaceButton.setOverrideBorder(true, replaceButton.raisedBorder);
    //replaceButton.setEnabled(false);

    findField.setColumns(textFieldLength);
    findField.setText("");
    findField.addKeyListener(new FindReplaceTextFieldKeyAdapter());

    //replaceField.setColumns(textFieldLength);
    //replaceField.addKeyListener(new InputFieldKeyAdapter());

    matchCaseButton = createCheckBox(getResourceString("SS_SR_MATCHCASE"));
    matchCaseButton.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            //don't care
        }
    });

    wrapSearchButton = createCheckBox(getResourceString("SS_SR_WRAP"));
    wrapSearchButton.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            setCheckAndSetWrapOption();
        }
    });

    searchSelectionChkBx = createCheckBox(getResourceString("SS_SR_SELECTED"));
    searchSelectionChkBx.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            setSearchSelectionOption();
            foundCell = null;
        }
    });

    //searchSelectionChkBx.setEnabled(false);

    builder.add(cancelButton, cc.xy(1, 1));
    builder.add(findLabel, cc.xy(3, 1));
    builder.add(findField, cc.xy(5, 1));
    builder.add(nextButton, cc.xy(7, 1));
    builder.add(previousButton, cc.xy(9, 1));
    builder.add(matchCaseButton, cc.xy(11, 1));
    builder.add(wrapSearchButton, cc.xy(13, 1));
    builder.add(searchSelectionChkBx, cc.xy(15, 1));

    // statusInfo = createLabel("");
    // builder.add(statusInfo,          cc.xy(15,1));
}

From source file:edu.ku.brc.specify.tools.schemalocale.FieldItemPanel.java

/**
 * //from   w  w  w.  jav a  2s.  c o  m
 */
public void buildUI() {
    setIgnoreChanges(true);

    fieldsList = createList(fieldsModel);

    fieldsList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                getAllDataFromUI();
                fieldSelected();
            }
        }
    });

    fieldsList.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e) {
            super.focusLost(e);
            //lastIndex = fieldsList.getSelectedIndex();
        }
    });

    fieldDescText.addKeyListener(new LengthWatcher(255));
    // setting min and pref sizes to some bogus values so that textarea shrinks with dialog
    fieldNameText.addKeyListener(new LengthWatcher(64));

    CellConstraints cc = new CellConstraints();

    int y = 1;

    JScrollPane fldsp = UIHelper.createScrollPane(fieldsList);

    // LocalizableNameDescIFace
    PanelBuilder pb = new PanelBuilder(new FormLayout("max(200px;p),4px,p,2px,p,10px,p,2px,p,f:p:g",
            (includeHiddenUI ? "p,2px," : "") + (isDBSchema ? "p,2px,p,2px," : "")
                    + (includeFormatAndAutoNumUI ? "p,2px,p,2px," : "")
                    + "p,2px,p,2px,p,2px,p,2px,p,2px,p,2px,f:p:g"),
            this);

    pb.add(fldsp, cc.xywh(1, y, 1, 7 + (isDBSchema ? 4 : 0)));
    pb.add(fieldNameLbl = createI18NFormLabel("SL_LABEL", SwingConstants.RIGHT), cc.xy(3, y));
    pb.add(fieldNameText, cc.xywh(5, y, 6, 1));
    y += 2;

    if (includeHiddenUI) {
        pb.add(fieldHideChk, cc.xy(5, y));
        y += 2;
    }

    pb.add(fieldDescLbl = createI18NFormLabel("SL_DESC", SwingConstants.RIGHT), cc.xy(3, y));
    JScrollPane sp = new JScrollPane(fieldDescText, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    pb.add(sp, cc.xywh(5, y, 6, 1));
    y += 2;
    fieldDescText.setLineWrap(true);
    fieldDescText.setWrapStyleWord(true);

    if (isDBSchema) {
        fieldTypeTxt = createLabel("");
        fieldLengthTxt = createLabel("");

        pb.add(fieldTypeLbl = createI18NFormLabel("SL_TYPE", SwingConstants.RIGHT), cc.xy(3, y));
        pb.add(fieldTypeTxt, cc.xy(5, y));

        pb.add(fieldReqChk = createCheckBox(getResourceString("SL_REQ")), cc.xy(9, y));
        y += 2;

        pb.add(fieldLengthLbl = createI18NFormLabel("SL_LENGTH", SwingConstants.RIGHT), cc.xy(3, y));
        pb.add(fieldLengthTxt, cc.xy(5, y));
        y += 2;

        fieldTypeTxt.setBackground(Color.WHITE);
        fieldLengthTxt.setBackground(Color.WHITE);
        fieldTypeTxt.setOpaque(true);
        fieldLengthTxt.setOpaque(true);
    }

    if (includeFormatAndAutoNumUI) {
        PanelBuilder inner = new PanelBuilder(new FormLayout("p,2px,p", "p"));

        formatSwitcherCombo = createComboBox();
        fmtCardLayout = new CardLayout();
        formatterPanel = new JPanel(fmtCardLayout);
        pb.add(formatLbl = createI18NFormLabel("SL_FMTTYPE", SwingConstants.RIGHT), cc.xy(3, y));

        inner.add(formatSwitcherCombo, cc.xy(1, 1));
        inner.add(formatterPanel, cc.xy(3, 1));

        pb.add(inner.getPanel(), cc.xywh(5, y, 6, 1));
        y += 2;

        ActionListener switchAL = new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                String item = (String) formatSwitcherCombo.getSelectedItem();
                if (item != null) {
                    fmtCardLayout.show(formatterPanel, item);
                    webLinkCombo.setEnabled(item.equals(SL_WEBLINK));

                    if (formatSwitcherCombo.getSelectedIndex() == 0) {
                        if (webLinkCombo.getModel().getSize() > 0) {
                            webLinkCombo.setSelectedIndex(0);
                        }
                        if (formatCombo.getModel().getSize() > 0) {
                            formatCombo.setSelectedIndex(0);
                        }
                        if (pickListCBX.getModel().getSize() > 0) {
                            pickListCBX.setSelectedIndex(0);
                        }
                    }
                }
            }
        };
        formatSwitcherCombo.addActionListener(switchAL);

        formatterPanel.add(SL_NONE, new JPanel());

        //--------------------------
        // UIFieldFormatter
        //--------------------------
        inner = new PanelBuilder(new FormLayout("max(p;150px),2px,min", "p"));

        formatCombo = createComboBox(new DefaultComboBoxModel());
        formatMoreBtn = createButton(ELIPSES);

        inner.add(formatCombo, cc.xy(1, 1));
        inner.add(formatMoreBtn, cc.xy(3, 1));

        formatMoreBtn.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                UIFormatterListEdtDlg dlg = new UIFormatterListEdtDlg((Frame) UIRegistry.getTopWindow(),
                        fieldInfo, true, schemaPanel.getUiFieldFormatterMgrCache());
                dlg.setVisible(true);
                if (!dlg.isCancelled() && dlg.hasChanged()) {
                    //schemaPanel.setHasChanged(true);
                    formHasChanged();

                    //fillFormatBox(dlg.getSelectedFormat());
                    setSelectedFieldFormatter(dlg.getSelectedFormat());
                }
            }
        });

        formatterPanel.add(SL_FORMAT, inner.getPanel());

        ActionListener changed = new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                formHasChanged();

                boolean hasFormat = formatCombo.getSelectedIndex() > 0;
                webLinkCombo.setEnabled(!hasFormat);
                if (hasFormat) {
                    webLinkCombo.setSelectedIndex(webLinkCombo.getModel().getSize() > 0 ? 0 : -1);
                    pickListCBX.setSelectedIndex(pickListCBX.getModel().getSize() > 0 ? 0 : -1);
                }
            }
        };
        formatCombo.addActionListener(changed);

        //--------------------------
        // WebLinks
        //--------------------------
        webLinkMoreBtn = createButton(ELIPSES);
        webLinkMoreBtn.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                WebLinkDef selectedWL = (WebLinkDef) webLinkCombo.getSelectedItem();
                WebLinkConfigDlg dlg = webLinkMgrCache.editWebLinks(tableInfo, false);
                if (dlg.getBtnPressed() == CustomDialog.OK_BTN) {
                    fillWebLinkBox();

                    formHasChanged();

                    if (selectedWL != null && !selectedWL.getName().equals(SL_WEBLINK)) {
                        dlg.setWebLink(selectedWL.getName());
                    }
                    if (dlg.getBtnPressed() == CustomDialog.OK_BTN) {
                        setSelectedWebLink(dlg.getSelectedItem());
                    }
                }
            }
        });

        inner = new PanelBuilder(new FormLayout("max(p;150px),2px,min", "p"));
        webLinkCombo = createComboBox();
        DefaultComboBoxModel model = (DefaultComboBoxModel) webLinkCombo.getModel();
        model.addElement(webLinkDefNone);
        webLinkCombo.setSelectedIndex(0);

        inner.add(webLinkCombo, cc.xy(1, 1));
        inner.add(webLinkMoreBtn, cc.xy(3, 1));

        ActionListener wlchanged = new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                formHasChanged();

                boolean hasWL = webLinkCombo.getSelectedIndex() > 0;
                webLinkCombo.setEnabled(hasWL);
                if (hasWL) {
                    formatCombo.setSelectedIndex(formatCombo.getModel().getSize() > 0 ? 0 : -1);
                    pickListCBX.setSelectedIndex(pickListCBX.getModel().getSize() > 0 ? 0 : -1);
                }
            }
        };
        webLinkCombo.addActionListener(wlchanged);

        formatterPanel.add(SL_WEBLINK, inner.getPanel());
    }

    //--------------------------
    // PickList
    //--------------------------

    pickListCBX = createComboBox(new DefaultComboBoxModel());
    pickListCBX.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            formHasChanged();
            if (formatCombo != null && pickListCBX.getSelectedIndex() > 0) {
                formatCombo.setSelectedIndex(formatCombo.getModel().getSize() > 0 ? 0 : -1);
                webLinkCombo.setSelectedIndex(webLinkCombo.getModel().getSize() > 0 ? 0 : -1);
            }
        }
    });
    pickListMoreBtn = createButton(ELIPSES);
    pickListMoreBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            LocalizableItemIFace currentField = prevField;
            prevField = getSelectedFieldItem();

            PickList selectedItem = (PickList) pickListCBX.getSelectedItem();

            PickListEditorDlg dlg = new PickListEditorDlg(
                    localizableIO.hasUpdatablePickLists() ? null : localizableIO, true, true);
            dlg.setTableInfo(tableInfo);
            dlg.setFieldInfo(fieldInfo);
            dlg.createUI();
            dlg.setSize(400, 500);
            dlg.setVisible(true);
            if (!dlg.isCancelled()) {
                if (dlg.hasChanged()) {
                    hasChanged = true;
                    Vector<PickList> list = dlg.getNewPickLists();
                    DefaultComboBoxModel plCbxModel = (DefaultComboBoxModel) pickListCBX.getModel();
                    for (int i = 0; i < plCbxModel.getSize(); i++) {
                        list.add((PickList) plCbxModel.getElementAt(i));
                    }
                    Collections.sort(list);
                    plCbxModel.removeAllElements();
                    plCbxModel.addElement(pickListNone);
                    int inx = -1;
                    int i = 0;
                    for (PickList pl : list) {
                        plCbxModel.addElement(pl);
                        if (inx == -1 && selectedItem != null
                                && ((selectedItem.getId() != null && pl.getId() != null
                                        && selectedItem.getId().equals(pl.getId()))
                                        || (selectedItem.getName() != null && pl.getName() != null
                                                && selectedItem.getName().equals(pl.getName())))) {
                            inx = i;
                        }
                        i++;
                    }
                    pickListCBX.setSelectedIndex(inx + 1);
                }
            }

            prevField = currentField;
        }
    });

    if (includeFormatAndAutoNumUI) {
        PanelBuilder inner = new PanelBuilder(new FormLayout("max(p;150px),2px,min", "p"));
        inner.add(pickListCBX, cc.xy(1, 1));
        inner.add(pickListMoreBtn, cc.xy(3, 1));

        formatterPanel.add(SL_PICKLIST, inner.getPanel());

    } else {
        pb.add(pickListLbl = createI18NFormLabel(SL_PICKLIST, SwingConstants.RIGHT), cc.xy(3, y));
        pb.add(pickListCBX, cc.xy(5, y));
        pb.add(pickListMoreBtn, cc.xy(7, y));
        y += 2;
    }

    nxtBtn = createI18NButton("SL_NEXT");
    nxtEmptyBtn = createI18NButton("SL_NEXT_EMPTY");
    fldSpellChkBtn = createI18NButton("SL_SPELL_CHECK");

    //JPanel bbp = ButtonBarFactory.buildCenteredBar(adjustButtonArray(new JButton[] {nxtEmptyBtn, nxtBtn, fldSpellChkBtn}));
    //bbp.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
    //pb.add(bbp,   cc.xywh(3, y, 8, 1));

    nxtBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            next();
        }
    });
    nxtEmptyBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            nextEmpty();
        }
    });

    fldSpellChkBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (checker != null) {
                checker.spellCheck(fieldDescText);
                checker.spellCheck(fieldNameText);
            }
        }

    });

    fieldHideChk.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            formHasChanged();
        }

    });

    fieldReqChk.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            formHasChanged();
        }

    });

    DocumentListener dl = new DocumentAdaptor() {
        @Override
        protected void changed(DocumentEvent e) {
            formHasChanged();
        }
    };

    fieldNameText.getDocument().addDocumentListener(dl);
    fieldDescText.getDocument().addDocumentListener(dl);
    /*        
            if (formatTxt != null)
            {
    formatTxt.getDocument().addDocumentListener(dl);
            }
    */
    SchemaI18NService.getInstance().checkCurrentLocaleMenu();

    enableUIControls(false);

    setIgnoreChanges(false);
}

From source file:greenfoot.gui.export.ExportPublishPane.java

/**
 * Creates a login panel with a username and password and a create account option
 * @return Login panel Component/*from www.j av  a2  s  . c  o m*/
 */
private JComponent getLoginPanel() {
    JComponent loginPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 8, 4));

    loginPanel.setBackground(background);
    loginPanel.setAlignmentX(LEFT_ALIGNMENT);
    Border border = BorderFactory.createCompoundBorder(BorderFactory.createLoweredBevelBorder(),
            BorderFactory.createEmptyBorder(12, 12, 12, 12));
    loginPanel.setBorder(border);

    JLabel text = new JLabel(Config.getString("export.publish.login"));
    text.setForeground(headingColor);
    text.setVerticalAlignment(SwingConstants.TOP);
    loginPanel.add(text);

    text = new JLabel(Config.getString("export.publish.username"), SwingConstants.TRAILING);
    text.setFont(font);
    loginPanel.add(text);
    userNameField = new JTextField(10);
    userNameField.setInputVerifier(new InputVerifier() {
        @Override
        public boolean verify(JComponent input) {
            String text = userNameField.getText();
            return text.length() > 0;
        }
    });
    userNameField.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e) {
            checkForExistingScenario();
        }
    });
    loginPanel.add(userNameField);
    text = new JLabel(Config.getString("export.publish.password"), SwingConstants.TRAILING);
    text.setFont(font);
    loginPanel.add(text);
    passwordField = new JPasswordField(10);
    loginPanel.add(passwordField);

    JLabel createAccountLabel = new JLabel(Config.getString("export.publish.createAccount"));
    {
        createAccountLabel.setBackground(background);

        createAccountLabel.setHorizontalAlignment(SwingConstants.RIGHT);
        GreenfootUtil.makeLink(createAccountLabel, createAccountUrl);
    }
    loginPanel.add(createAccountLabel);
    return loginPanel;
}

From source file:es.emergya.ui.plugins.admin.aux1.SummaryAction.java

@SuppressWarnings("unchecked")
private JPanel buildSimpleCentral(final String labelPie, final SaveOrUpdateAction guardar, final JFrame d) {
    JPanel central = new JPanel(new GridBagLayout());
    central.setOpaque(false);// w ww .java 2s. c  o  m
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.insets = new Insets(2, 1, 2, 1);
    gbc.gridwidth = 1;
    central.add(Box.createVerticalStrut(10), gbc);

    gbc.gridy++;
    gbc.gridx = 0;
    gbc.anchor = GridBagConstraints.LINE_END;
    JLabel nombreLbl = new JLabel("Nombre:", SwingConstants.RIGHT);
    central.add(nombreLbl, gbc);
    gbc.gridx++;
    gbc.gridwidth = 3;
    gbc.anchor = GridBagConstraints.LINE_START;
    central.add(nombre, gbc);
    gbc.gridy++;
    gbc.gridx = 0;
    gbc.gridwidth = 1;
    gbc.anchor = GridBagConstraints.LINE_END;
    JLabel apellidosLbl = new JLabel("Apellidos: ", SwingConstants.RIGHT);
    central.add(apellidosLbl, gbc);
    gbc.gridx++;
    gbc.gridwidth = 3;
    gbc.anchor = GridBagConstraints.LINE_START;
    central.add(apellidos, gbc);
    gbc.anchor = GridBagConstraints.LINE_END;
    JLabel rolLbl = new JLabel("Rol:", SwingConstants.RIGHT);
    gbc.gridy++;
    gbc.gridx = 0;
    gbc.gridwidth = 1;
    central.add(rolLbl, gbc);
    gbc.gridx++;
    gbc.gridwidth = 3;
    gbc.anchor = GridBagConstraints.LINE_START;
    central.add(rol, gbc);
    gbc.gridwidth = 1;
    gbc.anchor = GridBagConstraints.LINE_END;
    JLabel contrasenyaLbl = new JLabel("Contrasea:", SwingConstants.RIGHT);
    gbc.gridy++;
    gbc.gridx = 0;
    central.add(contrasenyaLbl, gbc);
    gbc.gridx++;
    gbc.anchor = GridBagConstraints.LINE_START;
    central.add(contrasenya, gbc);
    gbc.anchor = GridBagConstraints.LINE_END;
    JLabel contrasenya2Lbl = new JLabel("Repetir Contrasea:", SwingConstants.RIGHT);
    gbc.gridx++;
    central.add(contrasenya2Lbl, gbc);
    gbc.gridx++;
    gbc.anchor = GridBagConstraints.LINE_START;
    central.add(repetir, gbc);
    gbc.anchor = GridBagConstraints.LINE_END;
    JLabel administradorLbl = new JLabel("Administrador:", SwingConstants.RIGHT);
    gbc.gridy++;
    gbc.gridx = 0;
    central.add(administradorLbl, gbc);
    gbc.gridx++;
    gbc.anchor = GridBagConstraints.LINE_START;
    central.add(administrador, gbc);
    administrador.setOpaque(false);
    gbc.anchor = GridBagConstraints.LINE_END;
    JLabel habilitadoLbl = new JLabel("Habilitado", SwingConstants.RIGHT);
    gbc.gridx++;
    central.add(habilitadoLbl, gbc);
    gbc.gridx++;
    gbc.anchor = GridBagConstraints.LINE_START;
    central.add(habilitado, gbc);
    habilitado.setOpaque(false);

    gbc.gridx = 0;
    gbc.gridy++;
    gbc.anchor = GridBagConstraints.LINE_END;
    JLabel labl_pie = new JLabel(labelPie, JLabel.LEFT);
    central.add(labl_pie, gbc);
    textfieldPie.setColumns(textfieldSize);
    labl_pie.setLabelFor(textfieldPie);
    gbc.gridx++;
    gbc.gridwidth = 4;
    gbc.anchor = GridBagConstraints.LINE_START;
    central.add(textfieldPie, gbc);

    gbc.gridy++;
    gbc.gridx = 0;
    central.add(Box.createVerticalStrut(10), gbc);

    gbc.gridwidth = 2;
    gbc.gridy++;
    gbc.gridx = 1;
    JPanel botones = getBotonesSalir(guardar, d, 250);
    central.add(botones, gbc);

    ((DefaultComboBoxModel) rol.getModel()).removeAllElements();
    for (String r : RolConsultas.getAllNames()) {
        ((DefaultComboBoxModel) rol.getModel()).addElement(r);
    }

    return central;
}

From source file:edu.ku.brc.specify.plugins.latlon.LatLonUI.java

/**
 * Creates the UI.//from  www  .  j a  v a  2 s.  co m
 * @param localityCEP the locality object (can be null)
 */
protected void createEditUI() {
    loadAndPushResourceBundle("specify_plugins");

    PanelBuilder builder = new PanelBuilder(new FormLayout("p", "p, 2px, p"), this);

    Color bgColor = getBackground();
    bgColor = new Color(Math.min(bgColor.getRed() + 20, 255), Math.min(bgColor.getGreen() + 20, 255),
            Math.min(bgColor.getBlue() + 20, 255));
    //System.out.println(bgColor);
    setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(bgColor),
            BorderFactory.createEmptyBorder(4, 4, 4, 4)));

    for (int i = 0; i < types.length; i++) {
        typeMapper.put(types[i], typeStrs[i]);
    }

    currentType = LatLonUIIFace.LatLonType.LLPoint;

    pointImages = new ImageIcon[pointNames.length];
    for (int i = 0; i < pointNames.length; i++) {
        pointImages[i] = IconManager.getIcon(pointNames[i], IconManager.IconSize.Std16);
    }

    String[] formatLabels = new String[formats.length];
    for (int i = 0; i < formats.length; i++) {
        formatLabels[i] = getResourceString(formats[i]);
    }
    cardPanel = new JPanel(cardLayout);
    formatSelector = createComboBox(formatLabels);
    latLonPanes = new JComponent[formatLabels.length];

    formatSelector.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            swapForm(formatSelector.getSelectedIndex(), currentType);

            cardLayout.show(cardPanel, ((JComboBox) ae.getSource()).getSelectedItem().toString());

            //stateChanged(null);
        }
    });

    Dimension preferredSize = new Dimension(0, 0);
    cardSubPanes = new JPanel[formats.length * 2];
    panels = new DDDDPanel[formats.length * 2];
    int paneInx = 0;
    for (int i = 0; i < formats.length; i++) {
        cardSubPanes[i] = new JPanel(new BorderLayout());
        try {
            String packageName = "edu.ku.brc.specify.plugins.latlon.";
            DDDDPanel latLon1 = Class.forName(packageName + formatClass[i]).asSubclass(DDDDPanel.class)
                    .newInstance();
            latLon1.setIsRequired(isRequired);
            latLon1.setViewMode(isViewMode);
            latLon1.init();
            latLon1.setChangeListener(this);

            JPanel panel1 = latLon1;
            panel1.setBorder(panelBorder);
            panels[paneInx++] = latLon1;
            latLonPanes[i] = panel1;

            DDDDPanel latlon2 = Class.forName(packageName + formatClass[i]).asSubclass(DDDDPanel.class)
                    .newInstance();
            latlon2.setIsRequired(isRequired);
            latlon2.setViewMode(isViewMode);
            latlon2.init();
            latlon2.setChangeListener(this);

            panels[paneInx++] = latlon2;

            JTabbedPane tabbedPane = new JTabbedPane(
                    UIHelper.getOSType() == UIHelper.OSTYPE.MacOSX ? SwingConstants.BOTTOM
                            : SwingConstants.RIGHT);
            tabbedPane.addTab(null, pointImages[0], panels[paneInx - 2]);
            tabbedPane.addTab(null, pointImages[0], panels[paneInx - 1]);
            latLonPanes[i] = tabbedPane;

            Dimension size = tabbedPane.getPreferredSize();
            preferredSize.width = Math.max(preferredSize.width, size.width);
            preferredSize.height = Math.max(preferredSize.height, size.height);

            tabbedPane.removeAll();
            cardSubPanes[i].add(panel1, BorderLayout.CENTER);
            cardPanel.add(formatLabels[i], cardSubPanes[i]);

            /*if (locality != null)
            {
            latLon1.set(locality.getLatitude1(), locality.getLongitude1(), locality.getLat1text(), locality.getLong1text());
            latlon2.set(locality.getLatitude2(), locality.getLongitude2(), locality.getLat2text(), locality.getLong2text());
            }*/

        } catch (Exception e) {
            e.printStackTrace();
            edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
            edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(LatLonUI.class, e);
        }
    }

    // Makes they are all the same size
    for (int i = 0; i < formats.length; i++) {
        cardSubPanes[i].setPreferredSize(preferredSize);
    }

    //final LatLonPanel thisPanel = this;

    PanelBuilder botBtnBar = new PanelBuilder(new FormLayout("p:g,p,10px,p,10px,p,p:g", "p"));

    ButtonGroup btnGroup = new ButtonGroup();
    botBtns = new JToggleButton[typeNames.length];

    if (UIHelper.isMacOS()) {
        /*for (int i=0;i<botBtns.length;i++)
        {
        ImageIcon selIcon   = IconManager.getIcon(typeNames[i]+"Sel", IconManager.IconSize.Std16);
        ImageIcon unselIcon = IconManager.getIcon(typeNames[i], IconManager.IconSize.Std16);
                
        MacIconRadioButton rb = new MacIconRadioButton(selIcon, unselIcon);
        botBtns[i] = rb;
        rb.setBorder(new MacBtnBorder());
                
        Dimension size = rb.getPreferredSize();
        int max = Math.max(size.width, size.height);
        size.setSize(max, max);
        rb.setPreferredSize(size);
        }*/

        BorderedRadioButton.setSelectedBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
        BorderedRadioButton.setUnselectedBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
        for (int i = 0; i < botBtns.length; i++) {
            BorderedRadioButton rb = new BorderedRadioButton(
                    IconManager.getIcon(typeNames[i], IconManager.IconSize.Std16));
            botBtns[i] = rb;
            rb.makeSquare();
            rb.setBorder(new MacBtnBorder());
        }
    } else {
        BorderedRadioButton.setSelectedBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
        BorderedRadioButton.setUnselectedBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
        for (int i = 0; i < botBtns.length; i++) {
            BorderedRadioButton rb = new BorderedRadioButton(
                    IconManager.getIcon(typeNames[i], IconManager.IconSize.Std16));
            botBtns[i] = rb;
            rb.makeSquare();
        }
    }

    for (int i = 0; i < botBtns.length; i++) {
        botBtns[i].setToolTipText(typeToolTips[i]);
        botBtnBar.add(botBtns[i], cc.xy((i * 2) + 2, 1));
        btnGroup.add(botBtns[i]);
        selectedTypeHash.put(botBtns[i], types[i]);

        botBtns[i].addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent ce) {
                stateChanged(null);
                currentType = selectedTypeHash.get(ce.getSource());
                swapForm(formatSelector.getSelectedIndex(), currentType);
            }
        });
    }
    botBtns[0].setSelected(true);

    if (isViewMode) {
        typeLabel = createLabel(" ");
    }

    ActionListener infoAL = new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            doPrefs();
        }
    };

    JButton infoBtn = UIHelper.createIconBtn("Preferences", IconManager.IconSize.Std16,
            getResourceString("PREFERENCES"), true, infoAL);
    infoBtn.setEnabled(true);

    PanelBuilder topPane = new PanelBuilder(
            new FormLayout("l:p, c:p:g" + (isViewMode ? "" : ",4px,p,8px"), "p"));
    topPane.add(formatSelector, cc.xy(1, 1));
    topPane.add(isViewMode ? typeLabel : botBtnBar.getPanel(), cc.xy(2, 1));
    if (!isViewMode)
        topPane.add(infoBtn, cc.xy(4, 1));

    builder.add(topPane.getPanel(), cc.xy(1, 1));
    builder.add(cardPanel, cc.xy(1, 3));

    prefsPanel = new PrefsPanel(false);
    prefsPanel.add(getResourceString("LatLonUI.LL_SEP"));
    prefsPanel.add(CompType.eCheckbox, getResourceString("LatLonUI.LATDEF_DIR"), LAT_PREF, Boolean.class, true);
    prefsPanel.add(CompType.eCheckbox, getResourceString("LatLonUI.LONDEF_DIR"), LON_PREF, Boolean.class, true);
    prefsPanel.add(CompType.eComboBox, getResourceString("LatLonUI.DEF_TYP"), TYP_PREF, Integer.class,
            typeNamesLabels, 0);
    prefsPanel.add(CompType.eComboBox, getResourceString("LatLonUI.DEF_FMT"), FMT_PREF, Integer.class,
            formatLabels, 0);
    prefsPanel.createForm(null, null);

    popResourceBundle();
}

From source file:com.jwmsolutions.timeCheck.gui.TodoForm.java

private JCheckBox getJchkCompleted() {
    if (jchkCompleted == null) {
        jchkCompleted = new JCheckBox();
        jchkCompleted.setText("Completed");
        jchkCompleted.setHorizontalAlignment(SwingConstants.RIGHT);
        jchkCompleted.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                jchkCompletedActionPerformed(evt);
            }//from  w  ww .ja  v a 2 s .  com
        });
    }
    return jchkCompleted;
}