Example usage for javax.swing.border EtchedBorder LOWERED

List of usage examples for javax.swing.border EtchedBorder LOWERED

Introduction

In this page you can find the example usage for javax.swing.border EtchedBorder LOWERED.

Prototype

int LOWERED

To view the source code for javax.swing.border EtchedBorder LOWERED.

Click Source Link

Document

Lowered etched type.

Usage

From source file:com.ln.gui.Main.java

@SuppressWarnings("unchecked")
public Main() {/*from ww w  . j  a  v  a 2s.c  om*/
    System.gc();
    setIconImage(Toolkit.getDefaultToolkit().getImage(Configuration.mydir + "\\resources\\icons\\ln6464.png"));
    DateFormat dd = new SimpleDateFormat("dd");
    DateFormat dh = new SimpleDateFormat("HH");
    DateFormat dm = new SimpleDateFormat("mm");
    Date day = new Date();
    Date hour = new Date();
    Date minute = new Date();
    dayd = Integer.parseInt(dd.format(day));
    hourh = Integer.parseInt(dh.format(hour));
    minutem = Integer.parseInt(dm.format(minute));
    setTitle("Liquid Notify Revision 2");
    Description.setBackground(Color.WHITE);
    Description.setContentType("text/html");
    Description.setEditable(false);
    Getcalendar.Main();
    HyperlinkListener hyperlinkListener = new ActivatedHyperlinkListener(f, Description);
    Description.addHyperlinkListener(hyperlinkListener);
    //Add components
    setContentPane(contentPane);
    setJMenuBar(menuBar);
    contentPane.setLayout(
            new MigLayout("", "[220px:230.00:220,grow][209.00px:n:5000,grow]", "[22px][][199.00,grow][grow]"));
    eventsbtn.setToolTipText("Displays events currently set to notify");
    eventsbtn.setMinimumSize(new Dimension(220, 23));
    eventsbtn.setMaximumSize(new Dimension(220, 23));
    contentPane.add(eventsbtn, "cell 0 0");
    NewsArea.setBackground(Color.WHITE);
    NewsArea.setBorder(new BevelBorder(BevelBorder.LOWERED, Color.LIGHT_GRAY, Color.LIGHT_GRAY, Color.DARK_GRAY,
            Color.DARK_GRAY));
    NewsArea.setMinimumSize(new Dimension(20, 22));
    NewsArea.setMaximumSize(new Dimension(10000, 22));
    contentPane.add(NewsArea, "cell 1 0,growx,aligny top");
    menuBar.add(File);
    JMenuItem Settings = new JMenuItem("Settings");
    Settings.setIcon(new ImageIcon(Configuration.mydir + "\\resources\\icons\\settings.png"));
    Settings.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            Settings setup = new Settings();
            setup.setVisible(true);
            setup.setLocationRelativeTo(rootPane);
        }
    });
    File.add(Settings);
    File.add(mntmNewMenuItem);
    Tray.setIcon(new ImageIcon(Configuration.mydir + "\\resources\\icons\\ln1616.png"));
    File.add(Tray);
    Exit.setIcon(new ImageIcon(Configuration.mydir + "\\resources\\icons\\exit.png"));
    File.add(Exit);

    menuBar.add(mnNewMenu);

    Update.setIcon(new ImageIcon(Configuration.mydir + "\\resources\\icons\\update.png"));
    Update.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            try {
                URL localURL = new URL("http://jiiks.net23.net/tlnotify/online.html");
                URLConnection localURLConnection = localURL.openConnection();
                BufferedReader localBufferedReader = new BufferedReader(
                        new InputStreamReader(localURLConnection.getInputStream()));
                String str = localBufferedReader.readLine();
                if (!str.contains("YES")) {
                    String st2221 = "Updates server appears to be offline";
                    JOptionPane pane1 = new JOptionPane(st2221, JOptionPane.WARNING_MESSAGE,
                            JOptionPane.DEFAULT_OPTION);
                    JDialog dialog1 = pane1.createDialog("Update");
                    dialog1.setLocationRelativeTo(null);
                    dialog1.setVisible(true);
                    dialog1.setAlwaysOnTop(true);
                } else if (str.contains("YES")) {
                    URL localURL2 = new URL("http://jiiks.net23.net/tlnotify/latestversion.html");
                    URLConnection localURLConnection1 = localURL2.openConnection();
                    BufferedReader localBufferedReader2 = new BufferedReader(
                            new InputStreamReader(localURLConnection1.getInputStream()));
                    String str2 = localBufferedReader2.readLine();
                    Updatechecker.latestver = str2;
                    if (Integer.parseInt(str2) <= Configuration.version) {
                        String st2221 = "No updates available =(";
                        JOptionPane pane1 = new JOptionPane(st2221, JOptionPane.WARNING_MESSAGE,
                                JOptionPane.DEFAULT_OPTION);
                        JDialog dialog1 = pane1.createDialog("Update");
                        dialog1.setLocationRelativeTo(null);
                        dialog1.setVisible(true);
                        dialog1.setAlwaysOnTop(true);
                    } else if (Integer.parseInt(str2) > Configuration.version) {
                        String st2221 = "Updates available!";
                        JOptionPane pane1 = new JOptionPane(st2221, JOptionPane.WARNING_MESSAGE,
                                JOptionPane.DEFAULT_OPTION);
                        JDialog dialog1 = pane1.createDialog("Update");
                        dialog1.setLocationRelativeTo(null);
                        dialog1.setVisible(true);
                        dialog1.setAlwaysOnTop(true);

                        Updatechecker upd = new Updatechecker();
                        upd.setVisible(true);
                        upd.setLocationRelativeTo(rootPane);
                        upd.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
                    }
                }
            } catch (MalformedURLException e1) {
                e1.printStackTrace();
            } catch (IOException e1) {
                e1.printStackTrace();
            }

        }

    });
    mnNewMenu.add(Update);
    JMenuItem About = new JMenuItem("About");
    About.setIcon(new ImageIcon(Configuration.mydir + "\\resources\\icons\\about.png"));
    About.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            About a = new About();
            a.setVisible(true);
            a.setLocationRelativeTo(rootPane);
            a.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
        }
    });
    mnNewMenu.add(About);
    JMenuItem Github = new JMenuItem("Github");
    Github.setIcon(new ImageIcon(Configuration.mydir + "\\resources\\icons\\github.png"));
    Github.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            String url = "https://github.com/Jiiks/Liquid-Notify-Rev2";
            try {
                java.awt.Desktop.getDesktop().browse(java.net.URI.create(url));
            } catch (IOException e1) {
                e1.printStackTrace();
            }
        }
    });
    mnNewMenu.add(Github);
    JMenuItem Thread = new JMenuItem("Thread");
    Thread.setIcon(new ImageIcon(Configuration.mydir + "\\resources\\icons\\liquid.png"));
    Thread.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            String url = "http://www.teamliquid.net/forum/viewmessage.php?topic_id=318184";
            try {
                java.awt.Desktop.getDesktop().browse(java.net.URI.create(url));
            } catch (IOException e1) {
                e1.printStackTrace();
            }
        }
    });
    mnNewMenu.add(Thread);
    Refreshbtn.setToolTipText("Refreshes calendar, please don't spam ^_^");
    Refreshbtn.setPreferredSize(new Dimension(90, 20));
    Refreshbtn.setMinimumSize(new Dimension(100, 20));
    Refreshbtn.setMaximumSize(new Dimension(100, 20));
    contentPane.add(Refreshbtn, "flowx,cell 0 1,alignx left");
    //Components to secondary panel   
    Titlebox = new JComboBox();
    contentPane.add(Titlebox, "cell 1 1,growx,aligny top");
    Titlebox.setMinimumSize(new Dimension(20, 20));
    Titlebox.setMaximumSize(new Dimension(10000, 20));
    //Set other
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 686, 342);
    contentPane.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    NewsArea.setEnabled(false);
    NewsArea.setEditable(false);
    NewsArea.setText("News: " + News);
    contentPane.add(panel, "cell 0 2,grow");
    panel.setLayout(null);
    final JCalendar calendar = new JCalendar();
    calendar.getMonthChooser().setPreferredSize(new Dimension(120, 20));
    calendar.getMonthChooser().setMinimumSize(new Dimension(120, 24));
    calendar.getYearChooser().setLocation(new Point(20, 0));
    calendar.getYearChooser().setMaximum(100);
    calendar.getYearChooser().setMaximumSize(new Dimension(100, 2147483647));
    calendar.getYearChooser().setMinimumSize(new Dimension(50, 20));
    calendar.getYearChooser().setPreferredSize(new Dimension(50, 20));
    calendar.getYearChooser().getSpinner().setPreferredSize(new Dimension(100, 20));
    calendar.getYearChooser().getSpinner().setMinimumSize(new Dimension(100, 20));
    calendar.getMonthChooser().getSpinner().setPreferredSize(new Dimension(119, 20));
    calendar.getMonthChooser().getSpinner().setMinimumSize(new Dimension(120, 24));
    calendar.getDayChooser().getDayPanel().setFont(new Font("Tahoma", Font.PLAIN, 11));
    calendar.setDecorationBordersVisible(true);
    calendar.setTodayButtonVisible(true);
    calendar.setBackground(Color.LIGHT_GRAY);
    calendar.setBounds(0, 0, 220, 199);
    calendar.getDate();
    calendar.setWeekOfYearVisible(false);
    calendar.setDecorationBackgroundVisible(false);
    calendar.setMaxDayCharacters(2);
    calendar.getDayChooser().setFont(new Font("Tahoma", Font.PLAIN, 10));
    panel.add(calendar);
    Descriptionscrollpane.setLocation(new Point(100, 100));
    Descriptionscrollpane.setMaximumSize(new Dimension(10000, 10000));
    Descriptionscrollpane.setMinimumSize(new Dimension(20, 200));
    Description.setLocation(new Point(100, 100));
    Description.setBorder(new BevelBorder(BevelBorder.LOWERED, Color.LIGHT_GRAY, Color.LIGHT_GRAY,
            Color.DARK_GRAY, Color.DARK_GRAY));
    Description.setMaximumSize(new Dimension(1000, 400));
    Description.setMinimumSize(new Dimension(400, 200));
    contentPane.add(Descriptionscrollpane, "cell 1 2 1 2,growx,aligny top");
    Descriptionscrollpane.setViewportView(Description);
    verticalStrut.setMinimumSize(new Dimension(12, 20));
    contentPane.add(verticalStrut, "cell 0 1");
    Notify.setToolTipText("Adds selected event to notify event list.");
    Notify.setHorizontalTextPosition(SwingConstants.CENTER);
    Notify.setPreferredSize(new Dimension(100, 20));
    Notify.setMinimumSize(new Dimension(100, 20));
    Notify.setMaximumSize(new Dimension(100, 20));
    contentPane.add(Notify, "cell 0 1,alignx right");
    calendar.getMonthChooser().addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent e) {
            month = calendar.getMonthChooser().getMonth();
            Parser.parse();
        }
    });

    calendar.getDayChooser().addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent e) {
            try {
                int h = calendar.getMonthChooser().getMonth();
                @SuppressWarnings("deprecation")
                int date = calendar.getDate().getDate();
                int month = calendar.getMonthChooser().getMonth() + 1;
                globmonth = calendar.getMonthChooser().getMonth();
                sdate = date;
                datestring = Integer.toString(sdate);
                monthstring = Integer.toString(month);
                String[] Hours = Betaparser.Hours;
                String[] Titles = Betaparser.STitle;
                String[] Full = new String[Hours.length];
                String[] Minutes = Betaparser.Minutes;
                String[] Des = Betaparser.Description;
                String[] Des2 = new String[Betaparser.Description.length];
                String Seconds = "00";
                String gg;
                int[] IntHours = new int[Hours.length];
                int[] IntMins = new int[Hours.length];
                int Events = 0;
                monthday = monthstring + "|" + datestring + "|";
                Titlebox.removeAllItems();
                for (int a = 0; a != Hours.length; a++) {
                    IntHours[a] = Integer.parseInt(Hours[a]);
                    IntMins[a] = Integer.parseInt(Minutes[a]);
                }
                for (int i1 = 0; i1 != Hours.length; i1++) {
                    if (Betaparser.Events[i1].startsWith(monthday)) {
                        Full[i1] = String.format("%02d:%02d", IntHours[i1], IntMins[i1]) + " | " + Titles[i1];
                        Titlebox.addItem(Full[i1]);
                    }
                }
            } catch (Exception e1) {
                //Catching mainly due to boot property change            
            }
        }
    });
    Image image = Toolkit.getDefaultToolkit().getImage(Configuration.mydir + "\\resources\\icons\\ln1616.png");
    final SystemTray tray = SystemTray.getSystemTray();
    ActionListener listener = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            setVisible(true);
        }
    };
    PopupMenu popup = new PopupMenu();
    MenuItem defaultItem = new MenuItem();
    defaultItem.addActionListener(listener);
    TrayIcon trayIcon = null;
    trayIcon = new TrayIcon(image, "LiquidNotify Revision 2", popup);

    trayIcon.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent arg0) {
            setVisible(true);
        }
    });//
    try {
        tray.add(trayIcon);
    } catch (AWTException e) {
        System.err.println(e);
    }
    if (trayIcon != null) {
        trayIcon.setImage(image);
    }

    Tray.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            setVisible(false);
        }
    });

    Titlebox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            Descparser.parsedesc();
        }
    });

    Refreshbtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            Getcalendar.Main();
            Descparser.parsedesc();
        }
    });

    Notify.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            NOTIFY = Descparser.TTT;
            NOTIFYD = Descparser.DDD;
            NOTIFYH = Descparser.HHH;
            NOTIFYM = Descparser.MMM;
            int i = events;
            NOA[i] = NOTIFY;
            NOD[i] = NOTIFYD;
            NOH[i] = NOTIFYH;
            NOM[i] = NOTIFYM;
            Eventlist[i] = "Starts in: " + Integer.toString(NOD[i]) + " Days " + Integer.toString(NOH[i])
                    + " Hours " + Integer.toString(NOM[i]) + " Minutes " + " | " + NOA[i];
            events = events + 1;
            Notifylist si = new Notifylist();
            si.setVisible(false);
            si.setBounds(1, 1, 1, 1);
            si.dispose();
            if (thread.getState().name().equals("PENDING")) {
                thread.execute();
            }
        }
    });
    eventsbtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            Notifylist list = new Notifylist();
            if (played == 1) {
                asd.close();
                played = 0;
            }
            list.setVisible(true);
            list.setLocationRelativeTo(rootPane);
            list.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
        }
    });

    mntmNewMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (thread.getState().name().equals("PENDING")) {
                thread.execute();
            }
            Userstreams us = new Userstreams();
            us.setVisible(true);
            us.setLocationRelativeTo(rootPane);
        }
    });

    Exit.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            //Absolute exit
            JOptionPane.showMessageDialog(rootPane, "Bye bye :(", "Exit", JOptionPane.INFORMATION_MESSAGE);
            Runtime ln = Runtime.getRuntime();
            ln.gc();
            final Frame[] allf = Frame.getFrames();
            final Window[] allw = Window.getWindows();
            for (final Window allwindows : allw) {
                allwindows.dispose();
            }
            for (final Frame allframes : allf) {
                allframes.dispose();
                System.exit(0);
            }
        }
    });
}

From source file:com.mgmtp.perfload.loadprofiles.ui.AppFrame.java

/**
 * Creates the frame./*from  ww w .j  ava  2s . c o  m*/
 * 
 * @param configController
 *            the config controller
 * @param loadProfilesController
 *            the load profiles controller
 */
@Inject
public AppFrame(final ConfigController configController, final LoadProfilesController loadProfilesController,
        @AppVersion final String appVersion) {
    this.loadProfilesController = loadProfilesController;
    this.configController = configController;
    this.appVersion = appVersion;

    ThisWindowListener windowAdapter = new ThisWindowListener();
    addWindowStateListener(windowAdapter);
    addWindowListener(windowAdapter);
    addComponentListener(new ThisComponentListener());
    initComponents();
    initModels();
    cardLayout.show(pnlCard, "none");
    {
        chartPanel = new ChartPanel((JFreeChart) null);
        contentPane.add(chartPanel, "cell 0 2 2 1,grow");
        chartPanel.setBorder(new CompoundBorder(
                new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Load Profiles",
                        TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)),
                new CompoundBorder(new EmptyBorder(4, 4, 4, 4),
                        new EtchedBorder(EtchedBorder.LOWERED, null, null))));
        chartPanel.setName("chartPanel");
        chartPanel.setPopupMenu(null);
    }

    String fileName = configController.getAppProperties().getProperty("lpConfig.file");
    if (fileName != null) {
        loadProfileConfigFile = new File(fileName);
    }
    fileName = configController.getAppProperties().getProperty("lpEvents.file");
    if (fileName != null) {
        loadProfileEventsFile = new File(fileName);
    }
}

From source file:com.lynk.hrm.ui.dialog.InfoEmployee.java

private void initComponents() {
    addWindowListener(new WindowAdapter() {
        @Override//from   ww w.j  a  va 2 s  . c  om
        public void windowClosing(WindowEvent e) {
            thisWindowClosing(e);
        }
    });
    setSize(836, 674);
    setTitle("");
    setIconImage(
            Toolkit.getDefaultToolkit().getImage(InfoEmployee.class.getResource("/resource/image/icon.png")));
    setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
    getContentPane().setLayout(new BorderLayout(0, 0));
    {
        JToolBar toolBar = new JToolBar();
        toolBar.setFloatable(false);
        getContentPane().add(toolBar, BorderLayout.NORTH);
        {
            JButton uiSave = new JButton("?");
            uiSave.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    uiSaveActionPerformed(true);
                }
            });
            uiSave.setFocusable(false);
            uiSave.setIcon(new ImageIcon(InfoEmployee.class.getResource("/resource/image/emp_save.png")));
            uiSave.setFont(APP_FONT);
            toolBar.add(uiSave);
        }
        toolBar.addSeparator();
        {
            JButton uiReadIdCard = new JButton("??");
            uiReadIdCard.setFont(APP_FONT);
            uiReadIdCard.setIcon(
                    new ImageIcon(InfoEmployee.class.getResource("/resource/image/manager_teacher.png")));
            uiReadIdCard.setFocusable(false);
            uiReadIdCard.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    uiReadIdCardActionPerformed(e);
                }
            });
            toolBar.add(uiReadIdCard);
        }
        toolBar.addSeparator();
        {
            JButton uiInputFinger = new JButton("");
            uiInputFinger.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    uiInputFingerActionPerformed(e);
                }
            });
            uiInputFinger.setIcon(new ImageIcon(InfoEmployee.class.getResource("/resource/image/finger.png")));
            uiInputFinger.setFont(APP_FONT);
            uiInputFinger.setFocusable(false);
            toolBar.add(uiInputFinger);
        }
        toolBar.addSeparator();
        {
            JButton uiSetSuspend = new JButton("??");
            uiSetSuspend.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    uiSetSuspendActionPerformed(e);
                }
            });
            uiSetSuspend
                    .setIcon(new ImageIcon(InfoEmployee.class.getResource("/resource/image/emp_retire.png")));
            uiSetSuspend.setFont(APP_FONT);
            uiSetSuspend.setFocusable(false);
            toolBar.add(uiSetSuspend);
        }
    }

    {
        JPanel panel = new JPanel();
        getContentPane().add(panel);
        panel.setLayout(new MigLayout("", "[]5[grow]25[]5[grow]25[]5[grow]5[102]", "[][][][]"));
        {
            JLabel label = new JLabel("?");
            label.setHorizontalAlignment(SwingConstants.RIGHT);
            label.setFont(APP_FONT);
            panel.add(label, "cell 0 0");
        }
        {
            uiId = new LynkTextField();
            uiId.setEditable(false);
            uiId.setForeground(Color.BLUE);
            panel.add(uiId, "cell 1 0,growx");
        }
        {
            JLabel label = new JLabel("??");
            label.setHorizontalAlignment(SwingConstants.RIGHT);
            label.setFont(APP_FONT);
            panel.add(label, "cell 2 0");
        }
        {
            uiName = new LynkTextField();
            uiName.addFocusListener(new FocusAdapter() {
                @Override
                public void focusLost(FocusEvent e) {
                    uiNameFocusLost(e);
                }
            });
            panel.add(uiName, "cell 3 0,growx");
        }
        {
            JLabel label = new JLabel("?");
            label.setHorizontalAlignment(SwingConstants.RIGHT);
            label.setFont(APP_FONT);
            panel.add(label, "cell 4 0");
        }
        {
            uiNamePy = new LynkTextField();
            panel.add(uiNamePy, "cell 5 0,growx");
        }
        {
            JLabel label = new JLabel("?");
            label.setHorizontalAlignment(SwingConstants.RIGHT);
            label.setFont(APP_FONT);
            panel.add(label, "cell 0 1");
        }
        {
            uiState = new JComboBox<String>();
            uiState.setForeground(Color.BLUE);
            uiState.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    uiStateActionPerformed(e);
                }
            });
            uiState.setModel(new DefaultComboBoxModel<String>(new String[] { "", Employee.STATE_PROBATION,
                    Employee.STATE_CONTRACT, Employee.STATE_SUSPEND, Employee.STATE_LEAVE,
                    Employee.STATE_RETIRE, Employee.STATE_DELETE }));
            uiState.setFont(APP_FONT);
            panel.add(uiState, "cell 1 1,growx");
        }
        {
            uiInfoTab = new JideTabbedPane(JTabbedPane.TOP);
            uiInfoTab.addChangeListener(new ChangeListener() {
                public void stateChanged(ChangeEvent e) {
                    uiInfoTabStateChanged(e);
                }
            });
            uiInfoTab.setColorTheme(JideTabbedPane.COLOR_THEME_DEFAULT);
            uiInfoTab.setFont(APP_FONT);
            panel.add(uiInfoTab, "cell 0 3 7 1");
            {
                JPanel uiInfoBasic = new JPanel();
                uiInfoBasic.setLayout(new MigLayout("", "[473px,grow][307px,grow]", "[grow][289px][149px]"));
                uiInfoTab.addTab("?", uiInfoBasic);
                {
                    JPanel uiIdCardPane = new JPanel();
                    uiIdCardPane.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
                    uiIdCardPane.setLayout(new MigLayout("", "[]5[grow]10[]", "[][][][][40px:40px:40px,grow]"));
                    uiInfoBasic.add(uiIdCardPane, "cell 0 0,grow");
                    {
                        JLabel label = new JLabel("??");
                        uiIdCardPane.add(label, "cell 0 0");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiIdCard = new LynkTextField();
                        uiIdCardPane.add(uiIdCard, "cell 1 0,growx");
                    }
                    {
                        JPanel pane = new JPanel();
                        uiIdCardPane.add(pane, "cell 2 0 1 5,grow");
                        pane.setLayout(new MigLayout("insets 0", "[102px:102px:102px]", "[126px:126px:126px]"));
                        {
                            uiPhoto = new ImagePane();
                            pane.add(uiPhoto, "cell 0 0,grow");
                        }
                    }
                    //                  {
                    //                     JPanel photoPane = new JPanel();
                    //                     photoPane.setLayout(new MigLayout("insets 0", "[grow]", "[grow][]"));
                    //                     uiIdCardPane.add(photoPane, "cell 2 0 2 4,grow");
                    //                     {
                    //                        uiPhoto = new ImagePane();
                    //                        photoPane.add(uiPhoto, "cell 0 0,grow");
                    //                     }
                    //                     {
                    //                        JButton uiReadIdCardDirect = new JButton("??");
                    //                        uiReadIdCardDirect.addActionListener(new ActionListener() {
                    //                           public void actionPerformed(ActionEvent e) {
                    //                              uiReadIdCardDirectActionPerformed(e);
                    //                           }
                    //                        });
                    //                        uiReadIdCardDirect.setFont(APP_FONT);
                    //                        uiReadIdCardDirect.setFocusable(false);
                    //                        photoPane.add(uiReadIdCardDirect, "cell 0 1,grow");
                    //                     }
                    //                  }
                    {
                        JLabel label = new JLabel("");
                        uiIdCardPane.add(label, "cell 0 1");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiBirthday = new LynkTextField();
                        uiIdCardPane.add(uiBirthday, "cell 1 1,growx");
                    }
                    {
                        JLabel label = new JLabel("");
                        uiIdCardPane.add(label, "cell 0 2");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiAge = new LynkTextField();
                        uiIdCardPane.add(uiAge, "cell 1 2,growx");
                    }
                    {
                        JLabel label = new JLabel("");
                        uiIdCardPane.add(label, "cell 0 3,aligny top");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiGender = new LynkTextField();
                        uiIdCardPane.add(uiGender, "cell 1 3,growx,aligny top");
                    }
                    {
                        JLabel label = new JLabel("??");
                        label.setFont(APP_FONT);
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        uiIdCardPane.add(label, "cell 0 4");
                    }
                    {
                        JScrollPane scrollPane = new JScrollPane();
                        uiIdCardPane.add(scrollPane, "cell 1 4,grow");
                        {
                            uiCensusAddress = new JTextArea();
                            uiCensusAddress.setWrapStyleWord(true);
                            uiCensusAddress.setLineWrap(true);
                            scrollPane.setViewportView(uiCensusAddress);
                            uiCensusAddress.setFont(APP_FONT);
                        }
                    }
                }
                {
                    JPanel uiIdCardPane = new JPanel();
                    uiIdCardPane.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
                    uiIdCardPane
                            .setLayout(new MigLayout("", "[]5[grow]25[]5[grow]", "[][][40px:40px:40px,grow]"));
                    uiInfoBasic.add(uiIdCardPane, "cell 0 1,grow");
                    {
                        JLabel label = new JLabel("");
                        uiIdCardPane.add(label, "cell 0 0");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiMarital = new JComboBox<String>();
                        uiIdCardPane.add(uiMarital, "cell 1 0,growx");
                        uiMarital.setModel(new DefaultComboBoxModel<String>(
                                new String[] { Employee.MARITAL_YES, Employee.MARITAL_NO }));
                        uiMarital.setFont(APP_FONT);
                    }
                    {
                        JLabel label = new JLabel("?");
                        uiIdCardPane.add(label, "cell 2 0");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiContact = new LynkTextField();
                        uiIdCardPane.add(uiContact, "cell 3 0,growx");
                    }
                    {
                        JLabel label = new JLabel("?");
                        uiIdCardPane.add(label, "cell 0 1");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiCensus = new JComboBox<String>();
                        uiIdCardPane.add(uiCensus, "cell 1 1,growx");
                        uiCensus.setModel(new DefaultComboBoxModel<String>(
                                new String[] { Employee.CENSUS_A, Employee.CENSUS_B, Employee.CENSUS_C,
                                        Employee.CENSUS_D, Employee.CENSUS_E, Employee.CENSUS_F }));
                        uiCensus.setFont(APP_FONT);
                    }
                    {
                        JLabel label = new JLabel("??");
                        uiIdCardPane.add(label, "cell 2 1");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiResidencePermit = new JComboBox<String>();
                        uiIdCardPane.add(uiResidencePermit, "cell 3 1,growx");
                        uiResidencePermit
                                .setModel(new DefaultComboBoxModel<String>(new String[] { "", "", "" }));
                        uiResidencePermit.setFont(APP_FONT);
                    }
                    {
                        JLabel label = new JLabel("");
                        uiIdCardPane.add(label, "cell 0 2");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        JScrollPane scrollPane = new JScrollPane();
                        uiIdCardPane.add(scrollPane, "cell 1 2 3 1,grow");
                        {
                            uiAddress = new JTextArea();
                            uiAddress.setWrapStyleWord(true);
                            uiAddress.setLineWrap(true);
                            scrollPane.setViewportView(uiAddress);
                            uiAddress.setFont(APP_FONT);
                        }
                    }
                }
                {
                    JPanel uiCompanyPanel = new JPanel();
                    uiCompanyPanel.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
                    uiCompanyPanel.setLayout(new MigLayout("", "[]5[grow][]25[]5[grow][]", "[][][][][][][][]"));
                    uiInfoBasic.add(uiCompanyPanel, "cell 0 2,growx,aligny top");
                    {
                        JLabel label = new JLabel(Employee.SUSPEND_NOTE);
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                        uiCompanyPanel.add(label, "cell 0 0");
                    }
                    {
                        uiFactory = new JComboBox<String>(new DefaultComboBoxModel<String>(
                                new String[] { Employee.FACROTY_TC, Employee.FACTORY_SX }));
                        uiFactory.setFont(APP_FONT);
                        uiCompanyPanel.add(uiFactory, "cell 1 0 2 1,growx");
                    }
                    {
                        JLabel label = new JLabel("");
                        uiCompanyPanel.add(label, "cell 3 0");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiDept = new LynkTextField();
                        uiDept.setEditable(false);
                        uiCompanyPanel.add(uiDept, "cell 4 0,growx");
                    }
                    {
                        JButton uiChooseDept = new JButton();
                        uiChooseDept.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent e) {
                                uiChooseDeptActionPerformed(e);
                            }
                        });
                        uiChooseDept.setIcon(new ImageIcon(
                                InfoEmployee.class.getResource("/resource/image/choose_more.png")));
                        uiChooseDept.setMargin(new Insets(1, 1, 1, 1));
                        uiCompanyPanel.add(uiChooseDept, "cell 5 0,growx");
                    }
                    {
                        JLabel label = new JLabel("?");
                        uiCompanyPanel.add(label, "cell 0 1");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiJob = new LynkTextField();
                        uiJob.setEditable(false);
                        uiCompanyPanel.add(uiJob, "cell 1 1,growx");
                    }
                    {
                        JButton uiChooseJob = new JButton();
                        uiChooseJob.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent e) {
                                uiChooseJobActionPerformed(e);
                            }
                        });
                        uiChooseJob.setIcon(new ImageIcon(
                                InfoEmployee.class.getResource("/resource/image/choose_more.png")));
                        uiChooseJob.setMargin(new Insets(1, 1, 1, 1));
                        uiCompanyPanel.add(uiChooseJob, "cell 2 1,growx");
                    }
                    {
                        JLabel label = new JLabel(Employee.SUSPEND_START);
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                        uiCompanyPanel.add(label, "cell 3 1");
                    }
                    {
                        uiDdg = new JComboBox<String>(
                                new DefaultComboBoxModel<>(new String[] { Employee.DDG_N, Employee.DDG_Y }));
                        uiDdg.setFont(APP_FONT);
                        uiCompanyPanel.add(uiDdg, "cell 4 1 2 1,growx");
                    }
                    {
                        JLabel label = new JLabel("");
                        uiCompanyPanel.add(label, "cell 0 2");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiEntryDate = new JDateChooser();
                        uiCompanyPanel.add(uiEntryDate, "cell 1 2 2 1,growx");
                        uiEntryDate.setDateFormatString("yyyy-MM-dd");
                        uiEntryDate.setFont(APP_FONT);
                        uiEntryDate.getJCalendar().setTodayButtonVisible(true);
                        uiEntryDate.addPropertyChangeListener(new PropertyChangeListener() {

                            @Override
                            public void propertyChange(PropertyChangeEvent evt) {
                                if ("date".equals(evt.getPropertyName())) {
                                    setWorkAge();
                                }
                            }
                        });
                    }
                    {
                        JLabel label = new JLabel("");
                        uiCompanyPanel.add(label, "cell 3 2");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiWorkAge = new LynkTextField("0");
                        uiCompanyPanel.add(uiWorkAge, "cell 4 2 2 1,growx");
                        uiWorkAge.setEditable(false);
                    }
                    {
                        JLabel label = new JLabel("?");
                        uiCompanyPanel.add(label, "cell 0 3");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiProbation = new JDateChooser();
                        uiCompanyPanel.add(uiProbation, "cell 1 3 2 1,growx");
                        uiProbation.setDateFormatString("yyyy-MM-dd");
                        uiProbation.setFont(APP_FONT);
                        uiProbation.getJCalendar().setTodayButtonVisible(true);
                    }
                    {
                        JLabel label = new JLabel("??");
                        uiCompanyPanel.add(label, "cell 3 3");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiExpiration = new JDateChooser();
                        uiCompanyPanel.add(uiExpiration, "cell 4 3 2 1,growx");
                        uiExpiration.setDateFormatString("yyyy-MM-dd");
                        uiExpiration.setFont(APP_FONT);
                        uiExpiration.getJCalendar().setLeftButtonText(Employee.EXPIRATION_NO);
                        uiExpiration.getJCalendar().setLeftButtonVisible(true);
                        uiExpiration.getJCalendar().setRightButtonText(Employee.EXPIRATION_LONG);
                        uiExpiration.getJCalendar().setRightButtonVisible(true);
                    }
                    {
                        JLabel label = new JLabel("");
                        uiCompanyPanel.add(label, "cell 0 4");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiSchool = new LynkTextField();
                        uiCompanyPanel.add(uiSchool, "cell 1 4 2 1,growx");
                    }
                    {
                        JLabel label = new JLabel("");
                        uiCompanyPanel.add(label, "cell 3 4");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiDegree = new JComboBox<String>();
                        uiCompanyPanel.add(uiDegree, "cell 4 4 2 1,growx");
                        uiDegree.setMaximumRowCount(12);
                        uiDegree.setModel(new DefaultComboBoxModel<String>(new String[] { "", Employee.DEGREE_A,
                                Employee.DEGREE_B, Employee.DEGREE_C, Employee.DEGREE_D, Employee.DEGREE_E,
                                Employee.DEGREE_F, Employee.DEGREE_G, Employee.DEGREE_H, Employee.DEGREE_I,
                                Employee.DEGREE_J }));
                        uiDegree.setFont(APP_FONT);
                    }
                    {
                        JLabel label = new JLabel("");
                        uiCompanyPanel.add(label, "cell 0 5");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiMajor = new LynkTextField();
                        uiCompanyPanel.add(uiMajor, "cell 1 5 2 1,growx");
                    }
                    {
                        JLabel label = new JLabel("");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                        uiCompanyPanel.add(label, "cell 3 5");
                    }
                    {
                        uiGuide = new LynkTextField();
                        uiCompanyPanel.add(uiGuide, "cell 4 5 2 1,growx");
                    }
                    {
                        JLabel label = new JLabel("?");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT_BLOD);
                        uiCompanyPanel.add(label, "cell 0 6");
                    }
                    {
                        uiPhoneShort = new LynkTextField();
                        uiPhoneShort.setFont(APP_FONT_BLOD);
                        uiCompanyPanel.add(uiPhoneShort, "cell 1 6 2 1,growx");
                    }
                    {
                        JLabel label = new JLabel("?");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                        uiCompanyPanel.add(label, "cell 3 6");
                    }
                    {
                        uiPerformance = new LynkTextField();
                        uiCompanyPanel.add(uiPerformance, "cell 4 6 2 1,growx");
                    }
                    //                  {
                    //                     JLabel label = new JLabel("??");
                    //                     label.setHorizontalAlignment(SwingConstants.RIGHT);
                    //                     label.setFont(APP_FONT);
                    //                     uiCompanyPanel.add(label, "cell 0 7");
                    //                  }
                    //                  {
                    //                     uiSuspendEnd = new LynkTextField();
                    //                     uiCompanyPanel.add(uiSuspendEnd, "cell 1 7 5 1,growx");
                    //                  }
                }
                {
                    JPanel panel4 = new JPanel();
                    panel4.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
                    panel4.setLayout(new MigLayout("", "[]5[grow]", "[][][][grow][grow]"));
                    uiInfoBasic.add(panel4, "cell 1 0 1 3,grow");
                    {
                        JLabel label = new JLabel("???");
                        panel4.add(label, "cell 0 0,grow");
                        label.setFont(APP_FONT);
                    }
                    {
                        uiSocialCard = new LynkTextField();
                        panel4.add(uiSocialCard, "cell 1 0,grow");
                    }
                    {
                        JLabel label = new JLabel("?");
                        panel4.add(label, "cell 0 1,grow");
                        label.setFont(APP_FONT);
                    }
                    {
                        uiHousingCard = new LynkTextField();
                        panel4.add(uiHousingCard, "cell 1 1,grow");
                    }
                    {
                        JLabel label = new JLabel("??");
                        panel4.add(label, "cell 0 2,grow");
                        label.setFont(APP_FONT);
                    }
                    {
                        uiBankCard = new LynkTextField();
                        panel4.add(uiBankCard, "cell 1 2,grow");
                    }
                    {
                        JLabel label = new JLabel("?");
                        panel4.add(label, "cell 0 3,growx,aligny top");
                        label.setFont(APP_FONT);
                    }
                    {
                        JScrollPane scrollPane = new JScrollPane();
                        panel4.add(scrollPane, "cell 1 3,grow");
                        uiWorkExperience = new JTextArea();
                        uiWorkExperience.setFont(APP_FONT);
                        scrollPane.setViewportView(uiWorkExperience);
                    }
                    {
                        JLabel label = new JLabel("");
                        panel4.add(label, "cell 0 4,growx,aligny top");
                        label.setFont(APP_FONT);
                    }
                    {
                        JScrollPane scrollPane = new JScrollPane();
                        panel4.add(scrollPane, "cell 1 4,grow");
                        {
                            uiNote = new JTextArea();
                            uiNote.setFont(APP_FONT);
                            scrollPane.setViewportView(uiNote);
                        }
                    }
                }
            }
            {
                JPanel uiInfoLeave = new JPanel();
                uiInfoLeave.setLayout(new MigLayout("", "[]5[150px]25[]5[150px]", "[][][][grow][]"));
                uiInfoTab.addTab("??", uiInfoLeave);
                {
                    uiLabelLeaveDate = new JLabel("?");
                    uiLabelLeaveDate.setFont(APP_FONT);
                    uiInfoLeave.add(uiLabelLeaveDate, "cell 0 0,grow");
                }
                {
                    uiLeaveDate = new JDateChooser();
                    uiLeaveDate.setDateFormatString("yyyy-MM-dd");
                    uiLeaveDate.setFont(APP_FONT);
                    uiLeaveDate.getJCalendar().setTodayButtonVisible(true);
                    uiLeaveDate.getJCalendar().setNullDateButtonVisible(true);
                    uiInfoLeave.add(uiLeaveDate, "cell 1 0,growx,aligny top");
                }
                {
                    uiLabelSocialEnd = new JLabel("??");
                    uiLabelSocialEnd.setFont(APP_FONT);
                    uiInfoLeave.add(uiLabelSocialEnd, "cell 0 1,grow");
                }
                {
                    uiLabelHousingEnd = new JLabel("?");
                    uiLabelHousingEnd.setFont(APP_FONT);
                    uiInfoLeave.add(uiLabelHousingEnd, "cell 2 1,grow");
                }
                {
                    uiHousingEndDate = new JDateChooser();
                    uiHousingEndDate.setDateFormatString("yyyy-MM-dd");
                    uiHousingEndDate.setFont(APP_FONT);
                    uiHousingEndDate.getJCalendar().setLeftButtonText("");
                    uiHousingEndDate.getJCalendar().setLeftButtonVisible(true);
                    uiHousingEndDate.getJCalendar().setTodayButtonVisible(true);
                    uiHousingEndDate.getJCalendar().setNullDateButtonVisible(true);
                    uiInfoLeave.add(uiHousingEndDate, "cell 3 1,growx,aligny top");
                }
                {
                    uiLabelLeaveType = new JLabel("?");
                    uiLabelLeaveType.setFont(APP_FONT);
                    uiInfoLeave.add(uiLabelLeaveType, "cell 0 2,grow");
                }
                {
                    uiSocialEndDate = new JDateChooser();
                    uiSocialEndDate.setDateFormatString("yyyy-MM-dd");
                    uiSocialEndDate.setFont(APP_FONT);
                    uiSocialEndDate.getJCalendar().setLeftButtonText("");
                    uiSocialEndDate.getJCalendar().setLeftButtonVisible(true);
                    uiSocialEndDate.getJCalendar().setTodayButtonVisible(true);
                    uiSocialEndDate.getJCalendar().setNullDateButtonVisible(true);
                    uiInfoLeave.add(uiSocialEndDate, "cell 1 1,growx,aligny top");
                }
                {
                    uiLeaveType = new JComboBox<String>(new DefaultComboBoxModel<String>(
                            new String[] { "", Employee.LEAVE_TYPE_A, Employee.LEAVE_TYPE_B,
                                    Employee.LEAVE_TYPE_C, Employee.LEAVE_TYPE_D, Employee.LEAVE_TYPE_E,
                                    Employee.LEAVE_TYPE_F, Employee.LEAVE_TYPE_G, Employee.LEAVE_TYPE_H }));
                    uiLeaveType.setMaximumRowCount(10);
                    uiLeaveType.setFont(APP_FONT);
                    uiInfoLeave.add(uiLeaveType, "cell 1 2 3 1,grow");
                }
                {
                    uiLabelLeaveReason = new JLabel("?");
                    uiLabelLeaveReason.setFont(APP_FONT);
                    uiInfoLeave.add(uiLabelLeaveReason, "cell 0 3,growx,aligny top");
                }
                {
                    JScrollPane scrollPane_2 = new JScrollPane();
                    uiInfoLeave.add(scrollPane_2, "cell 1 3 3 1,grow");
                    {
                        uiLeaveReason = new JTextArea();
                        scrollPane_2.setViewportView(uiLeaveReason);
                        uiLeaveReason.setFont(APP_FONT);
                    }
                }
                {
                    JLabel label = new JLabel("??");
                    label.setHorizontalAlignment(SwingConstants.RIGHT);
                    label.setFont(APP_FONT);
                    uiInfoLeave.add(label, "cell 0 4");
                }
                {
                    uiTimeCardLeaveCertify = new LynkTextField();
                    uiTimeCardLeaveCertify.setEditable(false);
                    uiInfoLeave.add(uiTimeCardLeaveCertify, "cell 1 4 2 1,growx");
                }
                {
                    JButton uiPrintLeaveCertify = new JButton("???");
                    uiPrintLeaveCertify.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                            uiPrintLeaveCertifyActionPerformed(e);
                        }
                    });
                    uiPrintLeaveCertify.setToolTipText("???!");
                    uiPrintLeaveCertify.setFont(APP_FONT);
                    uiPrintLeaveCertify.setFocusable(false);
                    uiInfoLeave.add(uiPrintLeaveCertify, "cell 3 4,alignx right");
                }
            }
            {
                JPanel uiInfoSuspendHistory = new JPanel();
                uiInfoSuspendHistory.setLayout(new BorderLayout(0, 0));
                uiInfoTab.addTab("???", uiInfoSuspendHistory);
                {
                    JScrollPane scrollPane = new JScrollPane();
                    uiInfoSuspendHistory.add(scrollPane, BorderLayout.CENTER);
                    {
                        suspendModel = new EmployeeSuspendModel();
                        uiEmpSuspend = new LynkTable(suspendModel);
                        uiEmpSuspend.addHighlighter(UtilsClient.createAlignHighlighter());
                        uiEmpSuspend.setAutoResizeMode(LynkTable.AUTO_RESIZE_ALL_COLUMNS);
                        scrollPane.setRowHeaderView(new TableRowHead(uiEmpSuspend));
                        scrollPane.setViewportView(uiEmpSuspend);
                    }
                }
            }
            {
                JPanel uiInfoEmpHistory = new JPanel();
                uiInfoEmpHistory.setLayout(new BorderLayout(0, 0));
                uiInfoTab.addTab("?", uiInfoEmpHistory);
                {
                    JPanel pane = new JPanel();
                    pane.setLayout(new MigLayout("", "[][][][100px:100px:100px][]", "[]"));
                    uiInfoEmpHistory.add(pane, BorderLayout.NORTH);
                    {
                        JLabel label = new JLabel("");
                        label.setFont(APP_FONT);
                        pane.add(label, "cell 0 0");
                    }
                    {
                        uiHistoryType = new JComboBox<String>(new DefaultComboBoxModel<>(
                                new String[] { "", PraisePunish.TYPE_A, PraisePunish.TYPE_B,
                                        PraisePunish.TYPE_C, PraisePunish.TYPE_D, PraisePunish.TYPE_E,
                                        PraisePunish.TYPE_F, PraisePunish.TYPE_G, PraisePunish.TYPE_H }));
                        uiHistoryType.setFont(APP_FONT);
                        pane.add(uiHistoryType, "cell 1 0");
                    }
                    {
                        JLabel label = new JLabel("?");
                        label.setFont(APP_FONT);
                        pane.add(label, "cell 2 0");
                    }
                    {
                        uiHistoryOperator = new LynkTextField();
                        pane.add(uiHistoryOperator, "cell 3 0,growx");
                    }
                    {
                        JButton uiRefresh = new JButton("");
                        uiRefresh.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent e) {
                                uiRefreshActionPerformed(e);
                            }
                        });
                        uiRefresh.setIcon(
                                new ImageIcon(InfoEmployee.class.getResource("/resource/image/refresh.png")));
                        uiRefresh.setFont(APP_FONT);
                        uiRefresh.setFocusable(false);
                        pane.add(uiRefresh, "cell 4 0");
                    }
                }
                {
                    JScrollPane scrollPane = new JScrollPane();
                    uiInfoEmpHistory.add(scrollPane, BorderLayout.CENTER);
                    {
                        historyModel = new EmployeeHistoryModel();
                        uiEmployeeHistory = new LynkTable(historyModel);
                        uiEmployeeHistory.setColumnSize(70, 540, 50, 130, 90);
                        scrollPane.setViewportView(uiEmployeeHistory);
                        scrollPane.setRowHeaderView(new TableRowHead(uiEmployeeHistory));

                    }
                }
            }
            {
                JPanel uiInfoJobAdjustment = new JPanel();
                uiInfoJobAdjustment.setLayout(new BorderLayout(0, 0));
                uiInfoTab.addTab("?", uiInfoJobAdjustment);
                {
                    JToolBar toolBar = new JToolBar();
                    toolBar.setFloatable(false);
                    uiInfoJobAdjustment.add(toolBar, BorderLayout.NORTH);
                    {
                        {
                            JButton uiAddJobAdjust = new JButton("?");
                            uiAddJobAdjust.addActionListener(new ActionListener() {
                                public void actionPerformed(ActionEvent e) {
                                    uiAddJobAdjustActionPerformed(e);
                                }
                            });
                            uiAddJobAdjust.setIcon(
                                    new ImageIcon(InfoEmployee.class.getResource("/resource/image/add.png")));
                            uiAddJobAdjust.setFont(APP_FONT);
                            toolBar.add(uiAddJobAdjust);
                        }
                    }
                }
                {
                    JScrollPane scrollPane = new JScrollPane();
                    uiInfoJobAdjustment.add(scrollPane, BorderLayout.CENTER);
                    {
                        jobAdjustmentModel = new JobAdjustmentModel();
                        uiJobAdjustment = new LynkTable(jobAdjustmentModel);
                        uiJobAdjustment.setColumnSize(50, 100, 100, 100, 100, 100, 80, 100, 150);
                        scrollPane.setRowHeaderView(new TableRowHead(uiJobAdjustment));
                        scrollPane.setViewportView(uiJobAdjustment);
                    }
                }
            }
            {
                JPanel uiInfoPraisePunish = new JPanel();
                uiInfoTab.addTab("", uiInfoPraisePunish);
                uiInfoPraisePunish.setLayout(
                        new MigLayout("", "[]10[grow]30[]10[120]5[]5[120]20[]20[][grow]", "[][grow]"));
                {
                    uiPraisePunishDateStart = new JDateChooser();
                    uiPraisePunishDateStart.setFont(APP_FONT);
                    uiPraisePunishDateStart.setDateFormatString("yyyy-MM-dd");
                    uiInfoPraisePunish.add(uiPraisePunishDateStart, "cell 3 0,growx");
                }
                {
                    uiPraisePunishDateEnd = new JDateChooser();
                    uiPraisePunishDateEnd.setFont(APP_FONT);
                    uiPraisePunishDateEnd.setDateFormatString("yyyy-MM-dd");
                    uiInfoPraisePunish.add(uiPraisePunishDateEnd, "cell 5 0,growx");

                }

                JButton uiAddPraisePunish = new JButton("");
                uiAddPraisePunish.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        uiAddPraisePunishActionPerformed(e);
                    }
                });
                {
                    JButton uiFindPraisePunish = new JButton("");
                    uiFindPraisePunish.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                            uiFindPraisePunishActionPerformed(e);
                        }
                    });
                    {
                        JLabel label = new JLabel("");
                        label.setFont(APP_FONT);
                        uiInfoPraisePunish.add(label, "cell 0 0,alignx trailing");
                    }
                    {
                        uiPraisePunishType = new JComboBox<String>(
                                new DefaultComboBoxModel<String>(new String[] { "", PraisePunish.TYPE_A,
                                        PraisePunish.TYPE_B, PraisePunish.TYPE_C, PraisePunish.TYPE_D,
                                        PraisePunish.TYPE_E, PraisePunish.TYPE_F, PraisePunish.TYPE_G }));
                        uiPraisePunishType.setEditable(true);
                        uiPraisePunishType.setFont(APP_FONT);
                        uiInfoPraisePunish.add(uiPraisePunishType, "cell 1 0,growx");
                    }

                    {
                        JLabel label = new JLabel("");
                        label.setFont(APP_FONT);
                        uiInfoPraisePunish.add(label, "cell 2 0");
                    }
                    {
                        JLabel label = new JLabel("");
                        label.setFont(APP_FONT);
                        uiInfoPraisePunish.add(label, "cell 4 0");
                    }
                    uiFindPraisePunish.setFocusable(false);
                    uiFindPraisePunish.setIcon(
                            new ImageIcon(InfoEmployee.class.getResource("/resource/image/refresh.png")));
                    uiFindPraisePunish.setFont(APP_FONT);
                    uiInfoPraisePunish.add(uiFindPraisePunish, "cell 6 0");
                }
                uiAddPraisePunish
                        .setIcon(new ImageIcon(InfoEmployee.class.getResource("/resource/image/add.png")));
                uiAddPraisePunish.setFont(APP_FONT);
                uiAddPraisePunish.setFocusable(false);
                uiInfoPraisePunish.add(uiAddPraisePunish, "cell 7 0");

                JScrollPane scrollPane = new JScrollPane();
                uiInfoPraisePunish.add(scrollPane, "cell 0 1 9 1,grow");
                {
                    praisePunishModel = new PraisePunishModel(
                            new String[] { PraisePunish.COLUMN_TYPE, PraisePunish.COLUMN_ACTION,
                                    PraisePunish.COLUMN_ACTION_DATE, PraisePunish.COLUMN_DEAL,
                                    PraisePunish.COLUMN_DEAL_DATE, PraisePunish.COLUMN_NOTE });
                    uiPraisePunish = new LynkTable(praisePunishModel);
                    uiPraisePunish.setColumnVisible(
                            new String[] { PraisePunish.COLUMN_TYPE, PraisePunish.COLUMN_ACTION,
                                    PraisePunish.COLUMN_ACTION_DATE, PraisePunish.COLUMN_DEAL,
                                    PraisePunish.COLUMN_DEAL_DATE, PraisePunish.COLUMN_NOTE });
                    uiPraisePunish.setDefaultRenderer(Object.class, new PraisePunishColorRenderer());
                    uiPraisePunish.setMouseDoubleClick(new MouseDoubleClick() {

                        @Override
                        public void doubleClick(int index) {
                            if (index != -1) {
                                index = uiPraisePunish.convertRowIndexToModel(index);
                                PraisePunish pp = praisePunishModel.getPp(index);
                                pp = InfoPraisePunish.showdialog(InfoEmployee.this, pp, null);
                                if (pp != null) {
                                    praisePunishModel.updatePp(pp);
                                }
                            }
                        }
                    });
                    scrollPane.setViewportView(uiPraisePunish);
                    scrollPane.setRowHeaderView(new TableRowHead(uiPraisePunish));
                }
            }
            {
                JPanel uiPanelVacation = new JPanel();
                uiPanelVacation.setLayout(new BorderLayout());
                uiInfoTab.addTab("?", uiPanelVacation);
                {
                    JToolBar uiVacationToolBar = new JToolBar();
                    uiVacationToolBar.setFloatable(false);
                    uiPanelVacation.add(uiVacationToolBar, BorderLayout.NORTH);
                    {
                        JButton uiVacationRefresh = new JButton("");
                        uiVacationRefresh.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent e) {
                                uiVacationRefreshActionPerformed(e);
                            }
                        });
                        uiVacationRefresh.setIcon(
                                new ImageIcon(InfoEmployee.class.getResource("/resource/image/refresh.png")));
                        uiVacationRefresh.setFocusable(false);
                        uiVacationRefresh.setFont(APP_FONT);
                        uiVacationToolBar.add(uiVacationRefresh);
                    }
                    uiVacationToolBar.addSeparator();
                    {
                        uiVacationHistoryAdd = new JButton("");
                        uiVacationHistoryAdd.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent e) {
                                uiVacationAddActionPerformed(e);
                            }
                        });
                        uiVacationHistoryAdd.setIcon(
                                new ImageIcon(InfoEmployee.class.getResource("/resource/image/add.png")));
                        uiVacationHistoryAdd.setFocusable(false);
                        uiVacationHistoryAdd.setFont(APP_FONT);
                        uiVacationToolBar.add(uiVacationHistoryAdd);
                    }
                    uiVacationToolBar.addSeparator();
                    {
                        JButton uiEndLastLeft = new JButton("");
                        uiEndLastLeft.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent e) {
                                uiEndLastLeftActionPerformed(e);
                            }
                        });
                        uiEndLastLeft.setIcon(
                                new ImageIcon(InfoEmployee.class.getResource("/resource/image/add.png")));
                        uiEndLastLeft.setFocusable(false);
                        uiEndLastLeft.setFont(APP_FONT);
                        uiVacationToolBar.add(uiEndLastLeft);
                    }
                }
                {
                    JPanel uiPanelVacationInfo = new JPanel();
                    uiPanelVacation.add(uiPanelVacationInfo, BorderLayout.CENTER);
                    uiPanelVacationInfo.setLayout(new MigLayout("", "[grow]", "[][grow]"));

                    JPanel paneAv = new JPanel();
                    uiPanelVacationInfo.add(paneAv, "cell 0 0,grow");
                    paneAv.setLayout(new MigLayout("", "[][grow]50[][grow]", "[][][]"));
                    {
                        uiVacationStartEnd = new JLabel("Time");
                        uiVacationStartEnd.setHorizontalAlignment(SwingConstants.CENTER);
                        paneAv.add(uiVacationStartEnd, "cell 0 0 4 1,growx");
                        uiVacationStartEnd.setForeground(Color.BLUE);
                        uiVacationStartEnd.setFont(APP_FONT.deriveFont(16f));
                    }
                    {
                        JLabel labe = new JLabel(":");
                        paneAv.add(labe, "cell 0 1");
                        labe.setFont(APP_FONT.deriveFont(16f));
                    }
                    {
                        uiLastTotal = new JLabel("");
                        paneAv.add(uiLastTotal, "cell 1 1,alignx left");
                        uiLastTotal.setForeground(Color.BLUE);
                        uiLastTotal.setFont(APP_FONT.deriveFont(16f));
                    }
                    {
                        JLabel labe = new JLabel(":");
                        paneAv.add(labe, "cell 2 1");
                        labe.setFont(APP_FONT.deriveFont(16f));
                    }
                    {
                        uiLastLeft = new JLabel("");
                        paneAv.add(uiLastLeft, "cell 3 1,alignx left");
                        uiLastLeft.setForeground(Color.BLUE);
                        uiLastLeft.setFont(APP_FONT.deriveFont(16f));
                    }
                    {
                        JLabel labe = new JLabel(":");
                        paneAv.add(labe, "cell 0 2");
                        labe.setFont(APP_FONT.deriveFont(16f));
                    }
                    {
                        uiCurrentTotal = new JLabel("");
                        paneAv.add(uiCurrentTotal, "cell 1 2,alignx left");
                        uiCurrentTotal.setForeground(Color.BLUE);
                        uiCurrentTotal.setFont(APP_FONT.deriveFont(16f));
                    }
                    {
                        JLabel labe = new JLabel("?:");
                        paneAv.add(labe, "cell 2 2");
                        labe.setFont(APP_FONT.deriveFont(16f));
                    }
                    {
                        uiLeftHours = new JLabel("");
                        paneAv.add(uiLeftHours, "cell 3 2,alignx left");
                        uiLeftHours.setForeground(Color.BLUE);
                        uiLeftHours.setFont(APP_FONT.deriveFont(16f));
                    }

                    JScrollPane scrollPane = new JScrollPane();
                    uiPanelVacationInfo.add(scrollPane, "cell 0 1,grow");
                    {
                        attendanceVacationModel = new AttendanceVacationHistoryModel();
                        uiAttendanceVacationHistory = new LynkTable(attendanceVacationModel);
                        uiAttendanceVacationHistory.setAutoResizeMode(LynkTable.AUTO_RESIZE_ALL_COLUMNS);
                        scrollPane.setViewportView(uiAttendanceVacationHistory);
                        scrollPane.setRowHeaderView(new TableRowHead(uiAttendanceVacationHistory));
                    }
                }
            }
        }
    }

}

From source file:com.francetelecom.rd.dashboard.pc.DashboardPC.java

private void addRulePanelToDashboard(String ruleId) {

    if (myRulePanelMap.containsKey(ruleId)) {
        // remove it from display as it will be redisplayed
        rulesContent.remove(myRulePanelMap.remove(ruleId));
    }// w w w . j  a  v a2s  .  co  m

    Rule newRule;
    try {
        newRule = busConnector.getRule(ruleId);
    } catch (Exception e) {
        logger.error("Could not get new rule (" + ruleId + ") from bus connector! \n" + e.getMessage()
                + "Will not display new rule");
        e.printStackTrace();
        return;
    }

    // add panel elements : photo, service friendly name, IF label, condition parameter

    JPanel panelRule = new JPanel();
    panelRule.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    panelRule.setLayout(null);

    JPanel rulePanelServicePhoto = new JPanel();
    rulePanelServicePhoto.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    rulePanelServicePhoto.setBounds(10, 16, 27, 27);
    panelRule.add(rulePanelServicePhoto);

    String serviceName = "";
    String serviceDeviceOwner = "";
    try {
        String serviceId = newRule.getServiceReference();
        NodeService ns = busConnector.getNodeService(serviceId);
        serviceName = ns.getName();
        serviceDeviceOwner = busConnector.getServiceOwner(serviceId).getName();
    } catch (Exception e) {
        logger.error("Error when getting new rule's service name! \n" + e.getMessage());
        e.printStackTrace();
    }

    JLabel ruleLblServiceName = new JLabel(serviceName);
    ruleLblServiceName.setFont(new Font("Arial", Font.BOLD, 15));
    ruleLblServiceName.setForeground(new Color(100, 149, 237));
    ruleLblServiceName.setBounds(47, 11, 212, 18);
    panelRule.add(ruleLblServiceName);

    JLabel ruleLblOnDevice = new JLabel("on " + serviceDeviceOwner);
    ruleLblOnDevice.setForeground(Color.GRAY);
    ruleLblOnDevice.setFont(new Font("Arial", Font.PLAIN, 11));
    ruleLblOnDevice.setBounds(47, 29, 212, 14);
    panelRule.add(ruleLblOnDevice);

    JLabel ruleLblIf = new JLabel("IF");
    ruleLblIf.setForeground(Color.GRAY);
    ruleLblIf.setFont(new Font("Arial", Font.BOLD, 30));
    ruleLblIf.setBounds(10, 49, 27, 35);
    panelRule.add(ruleLblIf);

    // condition 
    Condition c = newRule.getCondition();
    // condition resource
    String[] resource = c.getResourcePath().split("\\.");
    // condition operator
    String operator = "";
    switch (c.getOperator()) {
    case Condition.OPERATOR_DIFF: {
        operator = "!=";
        break;
    }
    case Condition.OPERATOR_EQUAL: {
        operator = "=";
        break;
    }
    case Condition.OPERATOR_INF: {
        operator = "<";
        break;
    }
    case Condition.OPERATOR_INFEQUAL: {
        operator = "<=";
        break;
    }
    case Condition.OPERATOR_SUP: {
        operator = ">";
        break;
    }
    case Condition.OPERATOR_SUPEQUAL: {
        operator = ">=";
        break;
    }
    default: {
        logger.error("Unknown condition operator " + c.getOperator());
        break;
    }
    }
    // condition target value
    // FIXME the target value type is an int, that corresponds to static 
    // parameters from SDS that we dont have in Hlc
    // must find a way to make the types constants be available in Hlc
    // temporary solution : declared here
    String targetValue = "";
    switch (c.getTargetValueType()) {
    case TYPE_BOOL: {
        targetValue = String.valueOf(c.getTargetBooleanValue());
        break;
    }
    case TYPE_INT: {
        targetValue = String.valueOf(c.getTargetIntValue());
        break;
    }
    case TYPE_STRING: {
        targetValue = String.valueOf(c.getTargetStringValue());
        break;
    }
    default: {
        logger.warn("Attention target value type " + c.getTargetValueType() + " not treated!");
        break;
    }
    }

    String condition = resource[(resource.length - 1)] + " " + operator + " " + targetValue;
    JLabel ruleLblConditionParam = new JLabel(condition);
    ruleLblConditionParam.setFont(new Font("Arial", Font.BOLD, 13));
    ruleLblConditionParam.setForeground(Color.GRAY);
    ruleLblConditionParam.setBounds(47, 49, 192, 35);
    panelRule.add(ruleLblConditionParam);

    myRulePanelMap.put(ruleId, panelRule);
    rulesContent.add(panelRule);

    updateRuleListDisplay();

}

From source file:gov.nih.nci.nbia.StandaloneDMV3.java

private JPanel constructLoginPanel() {
    JPanel contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(36, 36, 36, 36));
    contentPane.setLayout(null);/*from   ww w.  j  ava 2s  . com*/

    JPanel guestPanel = new JPanel();
    guestPanel.setBounds(38, 40, 825, 140);
    guestPanel.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.RAISED, new Color(153, 180, 209), null),
            "  For Guest  ", TitledBorder.CENTER, TitledBorder.TOP, null, new Color(0, 120, 215)));
    contentPane.add(guestPanel);
    guestPanel.setLayout(null);

    JButton guestBtn = new JButton(GuestBtnLbl);
    guestBtn.setBounds(606, 50, 140, 36);
    guestBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            submitRequest(null, null);
        }
    });
    guestPanel.add(guestBtn);

    JLabel guestLbl = new JLabel("Log in as a guest to download public data only");
    guestLbl.setBounds(70, 50, 460, 42);
    guestPanel.add(guestLbl);

    JPanel loginUserPanel = new JPanel();
    loginUserPanel.setBounds(40, 258, 825, 306);
    contentPane.add(loginUserPanel);
    loginUserPanel
            .setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, new Color(153, 180, 209), null),
                    "  Login to Download Authorized Data  ", TitledBorder.CENTER, TitledBorder.TOP, null,
                    new Color(0, 120, 215)));
    loginUserPanel.setLayout(null);

    JLabel lblNewLabel_1 = new JLabel("User Name");
    lblNewLabel_1.setBounds(70, 80, 118, 36);
    loginUserPanel.add(lblNewLabel_1);

    JButton submitBtn = new JButton(SubmitBtnLbl);
    submitBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            userId = userNameFld.getText();
            password = passwdFld.getText();
            if ((userId.length() < 1) || (password.length() < 1)) {
                statusLbl.setText("Please enter a valid user name and password.");
                statusLbl.setForeground(Color.red);
            } else {
                submitRequest(userId, password);
            }
        }
    });
    submitBtn.setBounds(606, 238, 140, 36);
    loginUserPanel.add(submitBtn);

    userNameFld = new JTextField();
    userNameFld.setBounds(200, 80, 333, 36);
    loginUserPanel.add(userNameFld);
    userNameFld.setColumns(10);

    JLabel lblPassword = new JLabel("Password");
    lblPassword.setBounds(70, 156, 118, 36);
    loginUserPanel.add(lblPassword);

    passwdFld = new JPasswordField();
    passwdFld.setBounds(200, 156, 333, 36);
    loginUserPanel.add(passwdFld);

    statusLbl = new JLabel("");
    statusLbl.setBounds(70, 226, 463, 36);
    loginUserPanel.add(statusLbl);

    JLabel lblOr = new JLabel("--- OR ---");
    lblOr.setBounds(419, 212, 81, 26);
    contentPane.add(lblOr);

    JLabel versionLabel = new JLabel("Release " + DownloaderProperties.getAppVersion() + " Build \""
            + DownloaderProperties.getBuildTime() + "\"");
    versionLabel.setHorizontalAlignment(SwingConstants.CENTER);
    versionLabel.setForeground(new Color(70, 130, 180));
    versionLabel.setBounds(315, 584, 260, 20);
    contentPane.add(versionLabel);

    userNameFld.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            passwdFld.requestFocus();
        }
    });

    userNameFld.addFocusListener(new FocusListener() {

        @Override
        public void focusGained(FocusEvent e) {
            statusLbl.setText("");
        }

        @Override
        public void focusLost(FocusEvent e) {
        }
    });

    passwdFld.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            userId = userNameFld.getText();
            password = passwdFld.getText();
            if ((userId.length() < 1) || (password.length() < 1)) {
                statusLbl.setText("Please enter a valid user name and password.");
                statusLbl.setForeground(Color.red);
            } else
                submitRequest(userId, password);
        }
    });

    passwdFld.addFocusListener(new FocusListener() {

        @Override
        public void focusGained(FocusEvent e) {
            statusLbl.setText("");
        }

        @Override
        public void focusLost(FocusEvent e) {
        }
    });

    return contentPane;
}

From source file:com.mgmtp.perfload.loadprofiles.ui.AppFrame.java

/**
 * Mostly created by Eclipse WindowBuilder
 *//*from w  ww.  j a va  2 s  . c  o m*/
private void initComponents() {
    setTitle("perfLoad - Load Profile Configurator");
    setSize(1032, 984);
    setLocationRelativeTo(null);
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    SwingUtils.setUIFontStyle(Font.PLAIN);
    {
        JMenuBar menuBar = new JMenuBar();
        menuBar.setName("menuBar");
        setJMenuBar(menuBar);
        initMenuBar(menuBar);
    }

    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(new MigLayout("insets 0", "[grow][]", "[25px][400][grow]"));
    {
        JToolBar toolBar = new JToolBar() {
            @Override
            protected JButton createActionComponent(final Action a) {
                JButton button = super.createActionComponent(a);
                button.setFocusable(false);
                button.setHideActionText(false);
                return button;
            }
        };
        toolBar.setName("toolBar");
        contentPane.add(toolBar, "cell 0 0 2 1,growx,aligny top");
        initToolBar(toolBar);
    }
    {
        JScrollPane spTree = new JScrollPane();
        spTree.setBorder(new CompoundBorder(
                new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Load Profile Elements",
                        TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)),
                new EmptyBorder(4, 4, 4, 4)));
        contentPane.add(spTree, "cell 0 1,grow");
        spTree.setName("spTree");
        {
            tree = new JTree();
            tree.addKeyListener(new TreeKeyListener());
            tree.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
            tree.addTreeSelectionListener(new TreeTreeSelectionListener());
            tree.setShowsRootHandles(true);
            tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
            tree.setName("tree");
            spTree.setViewportView(tree);
        }
    }
    {
        JPanel pnlMain = new JPanel();
        contentPane.add(pnlMain, "cell 1 1");
        pnlMain.setName("pnlMain");
        pnlMain.setLayout(new MigLayout("insets 0", "[664!]", "[grow][]"));
        {
            JPanel pnlLoadProfileProperties = new JPanel();
            pnlLoadProfileProperties.setBorder(new TitledBorder(null, "Load Profile Properties",
                    TitledBorder.LEADING, TitledBorder.TOP, null, null));
            pnlLoadProfileProperties.setName("pnlLoadProfileProperties");
            pnlMain.add(pnlLoadProfileProperties, "flowx,cell 0 0,grow");
            pnlLoadProfileProperties
                    .setLayout(new MigLayout("insets 4", "[270,grow]8[]8[200]8[]8[200]", "[][][][grow]"));
            {
                lblName = new JLabel("Name");
                lblName.setDisplayedMnemonic('N');
                lblName.setHorizontalAlignment(SwingConstants.CENTER);
                lblName.setName("lblName");
                pnlLoadProfileProperties.add(lblName, "cell 0 0");
            }
            {
                JSeparator separator = new JSeparator();
                separator.setPreferredSize(new Dimension(0, 200));
                separator.setOrientation(SwingConstants.VERTICAL);
                separator.setName("separator");
                pnlLoadProfileProperties.add(separator, "cell 1 0 1 4, growy");
            }
            {
                JLabel lblClient = new JLabel("Clients");
                lblClient.setName("lblClient");
                pnlLoadProfileProperties.add(lblClient, "cell 2 0");
            }
            {
                JSeparator separator = new JSeparator();
                separator.setPreferredSize(new Dimension(0, 200));
                separator.setOrientation(SwingConstants.VERTICAL);
                separator.setName("separator");
                pnlLoadProfileProperties.add(separator, "cell 3 0 1 4, growy");
            }
            {
                lblTargets = new JLabel("Targets");
                lblTargets.setName("lblTargets");
                pnlLoadProfileProperties.add(lblTargets, "cell 4 0");
            }
            {
                txtName = new JTextField();
                lblName.setLabelFor(txtName);
                txtName.setColumns(10);
                txtName.setName("txtName");
                txtName.getDocument().addDocumentListener(dirtyListener);
                pnlLoadProfileProperties.add(txtName, "cell 0 1,growx");
            }
            {
                JScrollPane spClients = new JScrollPane();
                spClients.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
                spClients.setName("spClients");
                pnlLoadProfileProperties.add(spClients, "cell 2 1 1 3,grow");
                {
                    tblClients = new JCheckListTable();
                    tblClients.setName("tblClients");
                    spClients.setViewportView(tblClients);
                    spClients.setColumnHeaderView(null);
                }
            }
            {
                JScrollPane spTargets = new JScrollPane();
                spTargets.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
                spTargets.setName("spTargets");
                pnlLoadProfileProperties.add(spTargets, "cell 4 1 1 3,grow");
                {
                    tblTargets = new JCheckListTable();
                    tblTargets.setName("tblTargets");
                    spTargets.setViewportView(tblTargets);
                    spTargets.setColumnHeaderView(null);
                }
            }
            {
                lblDescription = new JLabel("Description");
                lblDescription.setDisplayedMnemonic('D');
                lblDescription.setName("lblDescription");
                pnlLoadProfileProperties.add(lblDescription, "cell 0 2");
            }
            {
                JScrollPane spDescription = new JScrollPane();
                spDescription.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
                spDescription.setName("spDescription");
                pnlLoadProfileProperties.add(spDescription, "cell 0 3,height 50:50:,grow");
                {
                    taDescription = new JTextArea();
                    taDescription.setFont(txtName.getFont());
                    lblDescription.setLabelFor(taDescription);
                    taDescription.setRows(3);
                    taDescription.setName("taDescription");
                    taDescription.getDocument().addDocumentListener(dirtyListener);
                    spDescription.setViewportView(taDescription);
                }
            }
        }
        {
            JPanel pnlCurveAssignment = new JPanel();
            pnlCurveAssignment.setBorder(new TitledBorder(null, "Active Load Curve Assignment",
                    TitledBorder.LEADING, TitledBorder.TOP, null, null));
            pnlMain.add(pnlCurveAssignment, "cell 0 1,grow");
            pnlCurveAssignment.setLayout(new MigLayout("insets 4", "[grow]", "[grow][]"));
            {
                pnlCard = new JPanel();
                pnlCard.setName("pnlCard");
                pnlCurveAssignment.add(pnlCard, "cell 0 0,grow");
                cardLayout = new CardLayout(0, 0);
                pnlCard.setLayout(cardLayout);
                {
                    stairsPanel = new StairsPanel();
                    stairsPanel.setName("stairsPanel");
                    pnlCard.add(stairsPanel, "stairs");
                }
                {
                    oneTimePanel = new OneTimePanel();
                    oneTimePanel.setName("oneTimePanel");
                    pnlCard.add(oneTimePanel, "oneTime");
                }
                {
                    markerPanel = new MarkerPanel();
                    markerPanel.setName("markerPanel");
                    pnlCard.add(markerPanel, "marker");
                }
                {
                    JLabel lblNoActiveCurve = new JLabel("no active curve assignment");
                    lblNoActiveCurve.setHorizontalAlignment(SwingConstants.CENTER);
                    pnlCard.add(lblNoActiveCurve, "none");
                    lblNoActiveCurve.setName("lblNoActiveCurve");
                }
            }
            {
                btnOk = new JButtonExt("OK");
                getRootPane().setDefaultButton(btnOk);
                btnOk.setEnabled(false);
                btnOk.addActionListener(new BtnOkActionListener());
                btnOk.setMnemonic(KeyEvent.VK_O);
                btnOk.setName("btnOk");
                pnlCurveAssignment.add(btnOk, "cell 0 1,alignx right");
            }
            {
                btnCancel = new JButtonExt("Cancel");
                btnCancel.setEnabled(false);
                btnCancel.addActionListener(new BtnCancelActionListener());
                btnCancel.setMnemonic(KeyEvent.VK_C);
                btnCancel.setName("btnCancel");
                pnlCurveAssignment.add(btnCancel, "cell 0 1,alignx right");
            }
        }
    }
}

From source file:userinterface.graph.Histogram.java

/**
 * Generates the property dialog for a Histogram. Allows the user to select either a new or an exisitng Histogram
 * to plot data on/*from  w  ww  .j  a  va 2s .  com*/
 * 
 * @param defaultSeriesName
 * @param handler instance of {@link GUIGraphHandler}
 * @param minVal the min value in data cache
 * @param maxVal the max value in data cache
 * @return Either a new instance of a Histogram or an old one depending on what the user selects
 */

public static Pair<Histogram, SeriesKey> showPropertiesDialog(String defaultSeriesName, GUIGraphHandler handler,
        double minVal, double maxVal) {

    // make sure that the probabilities are valid
    if (maxVal > 1.0)
        maxVal = 1.0;
    if (minVal < 0.0)
        minVal = 0.0;

    // set properties for the dialog
    JDialog dialog = new JDialog(GUIPrism.getGUI(), "Histogram properties", true);
    dialog.setLayout(new BorderLayout());

    JPanel p1 = new JPanel(new FlowLayout());
    p1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED),
            "Number of buckets"));

    JPanel p2 = new JPanel(new FlowLayout());
    p2.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED),
            "Series name"));

    JSpinner buckets = new JSpinner(new SpinnerNumberModel(10, 5, Integer.MAX_VALUE, 1));
    buckets.setToolTipText("Select the number of buckets for this Histogram");

    // provides the ability to select a new or an old histogram to plot the series on
    JTextField seriesName = new JTextField(defaultSeriesName);
    JRadioButton newSeries = new JRadioButton("New Histogram");
    JRadioButton existing = new JRadioButton("Existing Histogram");
    newSeries.setSelected(true);
    JPanel seriesSelectPanel = new JPanel();
    seriesSelectPanel.setLayout(new BoxLayout(seriesSelectPanel, BoxLayout.Y_AXIS));
    JPanel seriesTypeSelect = new JPanel(new FlowLayout());
    JPanel seriesOptionsPanel = new JPanel(new FlowLayout());
    seriesTypeSelect.add(newSeries);
    seriesTypeSelect.add(existing);
    JComboBox<String> seriesOptions = new JComboBox<>();
    seriesOptionsPanel.add(seriesOptions);
    seriesSelectPanel.add(seriesTypeSelect);
    seriesSelectPanel.add(seriesOptionsPanel);
    seriesSelectPanel.setBorder(BorderFactory
            .createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "Add series to"));

    // provides ability to select the min/max range of the plot
    JLabel minValsLabel = new JLabel("Min range:");
    JSpinner minVals = new JSpinner(new SpinnerNumberModel(0.0, 0.0, minVal, 0.01));
    minVals.setToolTipText("Does not allow value more than the min value in the probabilities");
    JLabel maxValsLabel = new JLabel("Max range:");
    JSpinner maxVals = new JSpinner(new SpinnerNumberModel(1.0, maxVal, 1.0, 0.01));
    maxVals.setToolTipText("Does not allow value less than the max value in the probabilities");
    JPanel minMaxPanel = new JPanel();
    minMaxPanel.setLayout(new BoxLayout(minMaxPanel, BoxLayout.X_AXIS));
    JPanel leftValsPanel = new JPanel(new BorderLayout());
    JPanel rightValsPanel = new JPanel(new BorderLayout());
    minMaxPanel.setBorder(
            BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "Range"));
    leftValsPanel.add(minValsLabel, BorderLayout.WEST);
    leftValsPanel.add(minVals, BorderLayout.CENTER);
    rightValsPanel.add(maxValsLabel, BorderLayout.WEST);
    rightValsPanel.add(maxVals, BorderLayout.CENTER);
    minMaxPanel.add(leftValsPanel);
    minMaxPanel.add(rightValsPanel);

    // fill the old histograms in the property dialog

    boolean found = false;
    for (int i = 0; i < handler.getNumModels(); i++) {

        if (handler.getModel(i) instanceof Histogram) {

            seriesOptions.addItem(handler.getGraphName(i));
            found = true;
        }

    }

    existing.setEnabled(found);
    seriesOptions.setEnabled(false);

    // the bottom panel
    JPanel options = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    JButton ok = new JButton("Plot");
    JButton cancel = new JButton("Cancel");

    // bind keyboard keys to plot and cancel buttons to improve usability

    ok.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "ok");
    ok.getActionMap().put("ok", new AbstractAction() {

        private static final long serialVersionUID = -7324877661936685228L;

        @Override
        public void actionPerformed(ActionEvent e) {

            ok.doClick();

        }
    });

    cancel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
            "ok");
    cancel.getActionMap().put("ok", new AbstractAction() {

        private static final long serialVersionUID = 2642213543774356676L;

        @Override
        public void actionPerformed(ActionEvent e) {

            cancel.doClick();

        }
    });

    //Action listener for the new series radio button
    newSeries.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (newSeries.isSelected()) {

                existing.setSelected(false);
                seriesOptions.setEnabled(false);
                buckets.setEnabled(true);
                buckets.setToolTipText("Select the number of buckets for this Histogram");
                minVals.setEnabled(true);
                maxVals.setEnabled(true);
            }
        }
    });

    //Action listener for the existing series radio button
    existing.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {

            if (existing.isSelected()) {

                newSeries.setSelected(false);
                seriesOptions.setEnabled(true);
                buckets.setEnabled(false);
                minVals.setEnabled(false);
                maxVals.setEnabled(false);
                buckets.setToolTipText("Number of buckets can't be changed on an existing Histogram");
            }

        }
    });

    //Action listener for the plot button
    ok.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {

            dialog.dispose();

            if (newSeries.isSelected()) {

                hist = new Histogram();
                hist.setNumOfBuckets((int) buckets.getValue());
                hist.setIsNew(true);

            } else if (existing.isSelected()) {

                String HistName = (String) seriesOptions.getSelectedItem();
                hist = (Histogram) handler.getModel(HistName);
                hist.setIsNew(false);

            }

            key = hist.addSeries(seriesName.getText());

            if (minVals.isEnabled() && maxVals.isEnabled()) {

                hist.setMinProb((double) minVals.getValue());
                hist.setMaxProb((double) maxVals.getValue());

            }
        }
    });

    //Action listener for the cancel button
    cancel.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            dialog.dispose();
            hist = null;
        }
    });

    dialog.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosed(WindowEvent e) {

            hist = null;
        }
    });

    p1.add(buckets, BorderLayout.CENTER);

    p2.add(seriesName, BorderLayout.CENTER);

    options.add(ok);
    options.add(cancel);

    // add everything to the main panel of the dialog
    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
    mainPanel.add(seriesSelectPanel);
    mainPanel.add(p1);
    mainPanel.add(p2);
    mainPanel.add(minMaxPanel);

    // add main panel to the dialog
    dialog.add(mainPanel, BorderLayout.CENTER);
    dialog.add(options, BorderLayout.SOUTH);

    // set dialog properties
    dialog.setSize(320, 290);
    dialog.setLocationRelativeTo(GUIPrism.getGUI());
    dialog.setVisible(true);

    // return the user selected Histogram with the properties set
    return new Pair<Histogram, SeriesKey>(hist, key);
}

From source file:com.floreantpos.ui.model.PizzaItemForm.java

private void initComponents() {
    setLayout(new BorderLayout());
    JLabel lblButtonColor = new JLabel(Messages.getString("MenuItemForm.19")); //$NON-NLS-1$
    tabbedPane = new javax.swing.JTabbedPane();

    JPanel tabGeneral = new javax.swing.JPanel();

    JLabel lblName = new JLabel();
    lblName.setHorizontalAlignment(SwingConstants.TRAILING);

    tfName = new com.floreantpos.swing.FixedLengthTextField(20);
    tfDescription = new JTextArea(new FixedLengthDocument(120));

    JLabel lTax = new javax.swing.JLabel();
    lTax.setHorizontalAlignment(SwingConstants.TRAILING);

    cbTax = new javax.swing.JComboBox();
    JButton btnNewTax = new javax.swing.JButton();

    JPanel tabShift = new javax.swing.JPanel();
    JPanel tabPrice = new javax.swing.JPanel();

    JPanel tabButtonStyle = new javax.swing.JPanel();
    JButton btnDeleteShift = new javax.swing.JButton();
    JButton btnAddShift = new javax.swing.JButton();

    JButton btnNewPrice = new javax.swing.JButton();
    JButton btnUpdatePrice = new javax.swing.JButton();
    JButton btnDeletePrice = new javax.swing.JButton();
    JButton btnDeleteAll = new javax.swing.JButton();
    JButton btnDefaultValue = new javax.swing.JButton();
    JButton btnAutoGenerate = new javax.swing.JButton();

    JScrollPane jScrollPane2 = new javax.swing.JScrollPane();
    JScrollPane priceTabScrollPane = new javax.swing.JScrollPane();

    shiftTable = new JTable();

    priceTable = new JTable();
    priceTable.setRowHeight(PosUIManager.getSize(priceTable.getRowHeight()));
    priceTable.setCellSelectionEnabled(true);
    priceTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    priceTable.setSurrendersFocusOnKeystroke(true);
    cbPrinterGroup = new JComboBox<PrinterGroup>(new DefaultComboBoxModel<PrinterGroup>(
            PrinterGroupDAO.getInstance().findAll().toArray(new PrinterGroup[0])));
    cbPrinterGroup.setPreferredSize(new Dimension(226, 0));

    tfDefaultSellPortion = new IntegerTextField(10);
    tfTranslatedName = new FixedLengthTextField(20);
    tfTranslatedName.setLength(120);//from www.  j ava2  s . co m
    lblKitchenPrinter = new JLabel(Messages.getString("MenuItemForm.27")); //$NON-NLS-1$
    lblName.setText(Messages.getString("LABEL_NAME")); //$NON-NLS-1$
    tfName.setLength(120);
    JLabel lblTranslatedName = new JLabel(Messages.getString("MenuItemForm.lblTranslatedName.text")); //$NON-NLS-1$
    tfSortOrder = new IntegerTextField(20);
    tfSortOrder.setText(""); //$NON-NLS-1$
    cbTax.setPreferredSize(new Dimension(198, 0));
    btnButtonColor = new JButton(); //$NON-NLS-1$
    btnButtonColor.setPreferredSize(new Dimension(228, 40));
    JLabel lblTextColor = new JLabel(Messages.getString("MenuItemForm.lblTextColor.text")); //$NON-NLS-1$
    btnTextColor = new JButton(Messages.getString("MenuItemForm.SAMPLE_TEXT")); //$NON-NLS-1$
    cbShowTextWithImage = new JCheckBox(Messages.getString("MenuItemForm.40")); //$NON-NLS-1$
    cbShowTextWithImage.setActionCommand(Messages.getString("MenuItemForm.41")); //$NON-NLS-1$
    lTax.setText(Messages.getString("LABEL_TAX")); //$NON-NLS-1$
    btnNewTax.setText("...");
    lTax.setText(Messages.getString("LABEL_TAX")); //$NON-NLS-1$

    btnNewTax.setText("..."); //$NON-NLS-1$
    btnNewTax.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnNewTaxdoCreateNewTax(evt);
        }
    });

    tabbedPane.addTab(com.floreantpos.POSConstants.GENERAL, tabGeneral);
    tabbedPane.setPreferredSize(new Dimension(750, 470));

    tabbedPane.addTab(com.floreantpos.POSConstants.MODIFIER_GROUPS, getModifierGroupTab());

    btnAddShift.addActionListener(this);
    btnDeleteShift.addActionListener(this);

    tabGeneral.setLayout(new MigLayout("insets 20", "[][]20px[][]", "[][][][][][][][][][][][][]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    tabGeneral.add(lblName, "cell 0 1 ,right"); //$NON-NLS-1$
    tabGeneral.add(tfName, "cell 1 1,grow"); //$NON-NLS-1$

    tabGeneral.add(lblTranslatedName, "cell 0 2,right"); //$NON-NLS-1$
    tabGeneral.add(tfTranslatedName, "cell 1 2,grow");

    JLabel lgroup = new javax.swing.JLabel();
    lgroup.setHorizontalAlignment(SwingConstants.TRAILING);
    lgroup.setText(Messages.getString("LABEL_GROUP")); //$NON-NLS-1$

    tabGeneral.add(lgroup, "cell 0 3,alignx right"); //$NON-NLS-1$
    JLabel lblBarcode = new JLabel(Messages.getString("MenuItemForm.lblBarcode.text")); //$NON-NLS-1$

    tabGeneral.add(lblBarcode, "cell 0 4,alignx right"); //$NON-NLS-1$
    tfBarcode = new FixedLengthTextField(20);
    tabGeneral.add(tfBarcode, "cell 1 4,grow"); //$NON-NLS-1$
    JLabel lblStockCount = new JLabel(Messages.getString("MenuItemForm.17")); //$NON-NLS-1$

    tabGeneral.add(lblStockCount, "cell 0 5,alignx right"); //$NON-NLS-1$
    tfStockCount = new DoubleTextField(1);
    tabGeneral.add(tfStockCount, "cell 1 5,grow"); //$NON-NLS-1$
    chkVisible = new javax.swing.JCheckBox();

    tabGeneral.add(new JLabel("Default sell portion (%)"), "cell 0 6");
    tabGeneral.add(tfDefaultSellPortion, "cell 1 6,grow");

    chkVisible.setText(com.floreantpos.POSConstants.VISIBLE);
    chkVisible.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
    chkVisible.setMargin(new java.awt.Insets(0, 0, 0, 0));

    tabGeneral.add(chkVisible, "cell 1 7");
    tabGeneral.add(lblKitchenPrinter, "cell 2 1,right"); //$NON-NLS-1$
    tabGeneral.add(cbPrinterGroup, "cell 3 1,grow"); //$NON-NLS-1$

    tabGeneral.add(lTax, "cell 2 2,right"); //$NON-NLS-1$
    tabGeneral.add(cbTax, "cell 3 2"); //$NON-NLS-1$
    tabGeneral.add(btnNewTax, "cell 3 2,grow"); //$NON-NLS-1$

    cbGroup = new javax.swing.JComboBox();
    cbGroup.setPreferredSize(new Dimension(198, 0));

    tabGeneral.add(cbGroup, "flowx,cell 1 3"); //$NON-NLS-1$
    JButton btnNewGroup = new javax.swing.JButton();

    btnNewGroup.setText("..."); //$NON-NLS-1$
    btnNewGroup.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            doCreateNewGroup(evt);
        }
    });
    tabGeneral.add(btnNewGroup, "cell 1 3"); //$NON-NLS-1$

    tabGeneral.add(new JLabel(Messages.getString("MenuItemForm.25")), "cell 2 3,right"); //$NON-NLS-1$ //$NON-NLS-2$
    orderList = new CheckBoxList();

    List<OrderType> orderTypes = Application.getInstance().getOrderTypes();
    orderList.setModel(orderTypes);

    JScrollPane orderCheckBoxList = new JScrollPane(orderList);
    orderCheckBoxList.setPreferredSize(new Dimension(228, 100));
    tabGeneral.add(orderCheckBoxList, "cell 3 3 3 3"); //$NON-NLS-1$
    cbDisableStockCount = new JCheckBox(Messages.getString("MenuItemForm.18")); //$NON-NLS-1$
    tabGeneral.add(cbDisableStockCount, "cell 1 8"); //$NON-NLS-1$

    tabGeneral.add(new JLabel(Messages.getString("MenuItemForm.29")), "cell 2 6,alignx right"); //$NON-NLS-1$ //$NON-NLS-2$
    JScrollPane scrlDescription = new JScrollPane(tfDescription, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrlDescription.setPreferredSize(new Dimension(228, 70));
    tfDescription.setLineWrap(true);
    tabGeneral.add(scrlDescription, "cell 3 6 3 3"); //$NON-NLS-1$

    add(tabbedPane);
    //TODO: 
    addRecepieExtension();

    btnDeleteShift.setText(com.floreantpos.POSConstants.DELETE_SHIFT);
    btnAddShift.setText(com.floreantpos.POSConstants.ADD_SHIFT);

    shiftTable
            .setModel(new javax.swing.table.DefaultTableModel(
                    new Object[][] { { null, null, null, null }, { null, null, null, null },
                            { null, null, null, null }, { null, null, null, null } },
                    new String[] { "Title 1", "Title 2", "Title 3", "Title 4" })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
    jScrollPane2.setViewportView(shiftTable);

    org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(tabShift);
    tabShift.setLayout(jPanel3Layout);
    jPanel3Layout
            .setHorizontalGroup(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel3Layout.createSequentialGroup().addContainerGap(76, Short.MAX_VALUE)
                            .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jScrollPane2,
                                            org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 670,
                                            org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                    .add(org.jdesktop.layout.GroupLayout.TRAILING,
                                            jPanel3Layout.createSequentialGroup().add(btnAddShift).add(5, 5, 5)
                                                    .add(btnDeleteShift)))
                            .addContainerGap()));
    jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel3Layout.createSequentialGroup()
                    .add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 345,
                            org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(btnAddShift).add(btnDeleteShift))
                    .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    tabbedPane.addTab(com.floreantpos.POSConstants.SHIFTS, tabShift);

    btnNewPrice.setText(Messages.getString("MenuItemForm.9")); //$NON-NLS-1$
    btnNewPrice.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            addNewPrice();
        }
    });
    btnUpdatePrice.setText(Messages.getString("MenuItemForm.13")); //$NON-NLS-1$
    btnUpdatePrice.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            updatePrice();
        }
    });
    btnDeletePrice.setText(Messages.getString("MenuItemForm.14")); //$NON-NLS-1$
    btnDeletePrice.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            deletePrice();
        }
    });

    btnAutoGenerate.setText("Auto Generate"); //$NON-NLS-1$
    btnAutoGenerate.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            autoGeneratePizzaItemSizeAndPrice();
        }
    });

    btnDeleteAll.setText(Messages.getString("MenuItemForm.15")); //$NON-NLS-1$
    btnDeleteAll.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            deleteAll();
        }
    });

    btnDefaultValue.setText(Messages.getString("MenuItemForm.7")); //$NON-NLS-1$
    priceTabScrollPane.setViewportView(priceTable);

    tabPrice.setLayout(new BorderLayout());
    tabPrice.add(priceTabScrollPane, BorderLayout.CENTER);

    JPanel buttonPanel = new JPanel();

    buttonPanel.add(btnNewPrice);
    buttonPanel.add(btnUpdatePrice);
    buttonPanel.add(btnDeletePrice);
    buttonPanel.add(btnAutoGenerate);

    tabPrice.add(buttonPanel, BorderLayout.SOUTH);
    tabGeneral.add(tabPrice, "cell 0 10,grow,span");
    tabbedPane.addChangeListener(this);

    tabButtonStyle.setLayout(new MigLayout("insets 10", "[][]100[][][][]", "[][][center][][][]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    JLabel lblImage = new JLabel(Messages.getString("MenuItemForm.28")); //$NON-NLS-1$
    lblImage.setHorizontalAlignment(SwingConstants.TRAILING);
    tabButtonStyle.add(lblImage, "cell 0 0,right"); //$NON-NLS-1$

    lblImagePreview = new JLabel(""); //$NON-NLS-1$
    lblImagePreview.setHorizontalAlignment(JLabel.CENTER);
    lblImagePreview.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    lblImagePreview.setPreferredSize(new Dimension(100, 100));
    tabButtonStyle.add(lblImagePreview, "cell 1 0"); //$NON-NLS-1$

    JButton btnSelectImage = new JButton("..."); //$NON-NLS-1$
    btnClearImage = new JButton(Messages.getString("MenuItemForm.34")); //$NON-NLS-1$
    tabButtonStyle.add(btnClearImage, "cell  1 0"); //$NON-NLS-1$
    tabButtonStyle.add(btnSelectImage, "cell 1 0"); //$NON-NLS-1$

    tabButtonStyle.add(lblButtonColor, "cell 0 2,right"); //$NON-NLS-1$
    tabButtonStyle.add(btnButtonColor, "cell 1 2,grow"); //$NON-NLS-1$
    tabButtonStyle.add(lblTextColor, "cell 0 3,right"); //$NON-NLS-1$
    tabButtonStyle.add(btnTextColor, "cell 1 3"); //$NON-NLS-1$
    tabButtonStyle.add(cbShowTextWithImage, "cell 1 4"); //$NON-NLS-1$

    btnTextColor.setPreferredSize(new Dimension(228, 50));

    btnSelectImage.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            doSelectImageFile();
        }
    });

    btnClearImage.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            doClearImage();
        }
    });

    btnButtonColor.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Color color = JColorChooser.showDialog(POSUtil.getBackOfficeWindow(),
                    Messages.getString("MenuItemForm.42"), btnButtonColor.getBackground()); //$NON-NLS-1$
            btnButtonColor.setBackground(color);
            btnTextColor.setBackground(color);
        }
    });

    btnTextColor.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Color color = JColorChooser.showDialog(POSUtil.getBackOfficeWindow(),
                    Messages.getString("MenuItemForm.43"), btnTextColor.getForeground()); //$NON-NLS-1$
            btnTextColor.setForeground(color);
        }
    });

    tabbedPane.addTab(Messages.getString("MenuItemForm.26"), tabButtonStyle); //$NON-NLS-1$
}

From source file:gov.nih.nci.nbia.StandaloneDMV3.java

/**
 * Create the panel./*ww  w  .ja v a 2s  .  c o  m*/
 */
private JPanel createloginPanelV2() {
    JPanel contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(36, 36, 36, 36));
    contentPane.setLayout(null);

    JPanel loginUserPanel = new JPanel();
    loginUserPanel.setBounds(40, 91, 825, 306);
    contentPane.add(loginUserPanel);
    loginUserPanel
            .setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, new Color(153, 180, 209), null),
                    "", TitledBorder.CENTER, TitledBorder.TOP, null, new Color(0, 120, 215)));
    loginUserPanel.setLayout(null);

    JLabel lblNewLabel_1 = new JLabel("User Name");
    lblNewLabel_1.setBounds(70, 80, 118, 36);
    loginUserPanel.add(lblNewLabel_1);

    JButton submitBtn = new JButton(SubmitBtnLbl);
    submitBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            userId = userNameFld.getText();
            password = passwdFld.getText();
            if ((userId.length() < 1) || (password.length() < 1)) {
                setStatus(statusLbl, "Please enter a valid user name and password.", Color.red);
            } else {
                setStatus(statusLbl, "Checking your access permission...", Color.blue);
                SwingUtilities.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        submitRequest(userId, password);
                    }
                });
            }
        }
    });
    submitBtn.setBounds(606, 238, 140, 36);
    loginUserPanel.add(submitBtn);

    userNameFld = new JTextField();
    userNameFld.setBounds(200, 80, 333, 36);
    loginUserPanel.add(userNameFld);
    userNameFld.setColumns(10);

    JLabel lblPassword = new JLabel("Password");
    lblPassword.setBounds(70, 156, 118, 36);
    loginUserPanel.add(lblPassword);

    passwdFld = new JPasswordField();
    passwdFld.setBounds(200, 156, 333, 36);
    loginUserPanel.add(passwdFld);

    statusLbl = new JLabel("");
    statusLbl.setBounds(70, 226, 524, 36);
    statusLbl.setFont(new Font("SansSerif", Font.PLAIN, 13));
    statusLbl.setVerticalAlignment(SwingConstants.BOTTOM);
    loginUserPanel.add(statusLbl);

    JLabel versionLabel = new JLabel("Release " + DownloaderProperties.getAppVersion() + " Build \""
            + DownloaderProperties.getBuildTime() + "\"");
    versionLabel.setHorizontalAlignment(SwingConstants.CENTER);
    versionLabel.setForeground(new Color(70, 130, 180));
    versionLabel.setBounds(318, 427, 266, 20);
    contentPane.add(versionLabel);

    JLabel infoLbl = new JLabel(
            "This download contains restricted data. Log in or contact the help desk for access.");
    infoLbl.setForeground(new Color(105, 105, 105));
    infoLbl.setFont(new Font("SansSerif", Font.BOLD, 13));
    infoLbl.setBounds(40, 34, 796, 42);
    contentPane.add(infoLbl);

    JLabel helpDeskLbl;

    helpDeskLbl = new JLabel();
    ImageIcon image = new ImageIcon(this.getClass().getClassLoader().getResource("info.png"));
    helpDeskLbl = new JLabel(image);
    helpDeskLbl.setToolTipText("Click to get phone number/email address of the Help Desk.");
    helpDeskLbl.setBounds(826, 20, 36, 36);
    contentPane.add(helpDeskLbl);

    helpDeskLbl.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            System.out.println("mouse clicked");
            //BrowserLauncher.openUrl(DownloaderProperties.getHelpDeskUrl());
            BrowserLauncher.openUrlForHelpDesk();
        }

    });

    userNameFld.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            passwdFld.requestFocus();
        }
    });

    userNameFld.addFocusListener(new FocusListener() {

        @Override
        public void focusGained(FocusEvent e) {
            statusLbl.setText("");
        }

        @Override
        public void focusLost(FocusEvent e) {
        }
    });

    passwdFld.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            userId = userNameFld.getText();
            password = passwdFld.getText();
            if ((userId.length() < 1) || (password.length() < 1)) {
                setStatus(statusLbl, "Please enter a valid user name and password.", Color.red);
            } else {
                setStatus(statusLbl, "Checking your access permission...", Color.blue);
                SwingUtilities.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        submitRequest(userId, password);
                    }
                });
            }
        }
    });

    passwdFld.addFocusListener(new FocusListener() {

        @Override
        public void focusGained(FocusEvent e) {
            statusLbl.setText("");
        }

        @Override
        public void focusLost(FocusEvent e) {
        }
    });

    return contentPane;
}

From source file:de.huxhorn.lilith.swing.MainFrame.java

public MainFrame(ApplicationPreferences applicationPreferences, SplashScreen splashScreen, String appName,
        boolean enableBonjour) {
    super(appName);
    this.applicationPreferences = applicationPreferences;
    this.coloringWholeRow = this.applicationPreferences.isColoringWholeRow();
    this.splashScreen = splashScreen;
    setSplashStatusText("Creating main frame.");

    groovyFormatter = new GroovyEventWrapperHtmlFormatter(applicationPreferences);
    thymeleafFormatter = new ThymeleafEventWrapperHtmlFormatter(applicationPreferences);

    smallProgressIcon = new ImageIcon(MainFrame.class.getResource("/otherGraphics/Progress16.gif"));
    ImageIcon frameIcon = new ImageIcon(MainFrame.class.getResource("/otherGraphics/Lilith16.jpg"));
    setIconImage(frameIcon.getImage());//from   www.j  av  a 2  s .  com
    //colorsReferenceQueue=new ReferenceQueue<Colors>();
    //colorsCache=new ConcurrentHashMap<EventIdentifier, SoftColorsReference>();
    application = new DefaultApplication();
    autostartProcesses = new ArrayList<AutostartRunnable>();

    addWindowListener(new MainWindowListener());
    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); // fixes ticket #79 
    Runtime runtime = Runtime.getRuntime();
    Thread shutdownHook = new Thread(new ShutdownRunnable());
    runtime.addShutdownHook(shutdownHook);

    senderService = new SenderService(this);
    this.enableBonjour = enableBonjour;
    /*
    if(application.isMac())
    {
       setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
    }
    else
    {
       setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
      */

    longTaskManager = new TaskManager<Long>();
    longTaskManager.setUsingEventQueue(true);
    longTaskManager.startUp();
    longTaskManager.addTaskListener(new MainTaskListener());

    startupApplicationPath = this.applicationPreferences.getStartupApplicationPath();

    loggingFileFactory = new LogFileFactoryImpl(new File(startupApplicationPath, LOGGING_FILE_SUBDIRECTORY));
    accessFileFactory = new LogFileFactoryImpl(new File(startupApplicationPath, ACCESS_FILE_SUBDIRECTORY));

    Map<String, String> loggingMetaData = new HashMap<String, String>();
    loggingMetaData.put(FileConstants.CONTENT_TYPE_KEY, FileConstants.CONTENT_TYPE_VALUE_LOGGING);
    loggingMetaData.put(FileConstants.CONTENT_FORMAT_KEY, FileConstants.CONTENT_FORMAT_VALUE_PROTOBUF);
    loggingMetaData.put(FileConstants.COMPRESSION_KEY, FileConstants.COMPRESSION_VALUE_GZIP);
    // TODO: configurable format and compressed

    loggingFileBufferFactory = new LoggingFileBufferFactory(loggingFileFactory, loggingMetaData);

    Map<String, String> accessMetaData = new HashMap<String, String>();
    accessMetaData.put(FileConstants.CONTENT_TYPE_KEY, FileConstants.CONTENT_TYPE_VALUE_ACCESS);
    accessMetaData.put(FileConstants.CONTENT_FORMAT_KEY, FileConstants.CONTENT_FORMAT_VALUE_PROTOBUF);
    accessMetaData.put(FileConstants.COMPRESSION_KEY, FileConstants.COMPRESSION_VALUE_GZIP);
    // TODO: configurable format and compressed

    accessFileBufferFactory = new AccessFileBufferFactory(accessFileFactory, accessMetaData);

    rrdFileFilter = new RrdFileFilter();

    loggingEventViewManager = new LoggingEventViewManager(this);
    accessEventViewManager = new AccessEventViewManager(this);
    this.applicationPreferences.addPropertyChangeListener(new PreferencesChangeListener());
    loggingSourceListener = new LoggingEventSourceListener();
    accessSourceListener = new AccessEventSourceListener();
    // this.cleanupWindowChangeListener = new CleanupWindowChangeListener();
    desktop = new JDesktopPane();
    statusBar = new JPanel(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    statusLabel = new JLabel();
    statusLabel.setText("Starting...");

    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.weightx = 0.0;
    gbc.anchor = GridBagConstraints.CENTER;
    gbc.insets = new Insets(0, 5, 0, 0);

    statusBar.add(statusLabel, gbc);

    taskStatusLabel = new JLabel();
    taskStatusLabel.setText("");
    taskStatusLabel.setForeground(Color.BLUE);
    taskStatusLabel.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent mouseEvent) {
            showTaskManager();
        }

        @Override
        public void mouseEntered(MouseEvent mouseEvent) {
            taskStatusLabel.setForeground(Color.RED);
        }

        @Override
        public void mouseExited(MouseEvent mouseEvent) {
            taskStatusLabel.setForeground(Color.BLUE);
        }
    });
    gbc.gridx = 1;
    gbc.gridy = 0;
    gbc.weightx = 1.0;
    gbc.anchor = GridBagConstraints.CENTER;
    gbc.insets = new Insets(0, 5, 0, 0);
    statusBar.add(taskStatusLabel, gbc);

    MemoryStatus memoryStatus = new MemoryStatus();
    memoryStatus.setBackground(Color.WHITE);
    memoryStatus.setOpaque(true);
    memoryStatus.setUsingBinaryUnits(true);
    memoryStatus.setUsingTotal(false);
    memoryStatus.setBorder(new EtchedBorder(EtchedBorder.LOWERED));

    gbc.fill = GridBagConstraints.NONE;
    gbc.gridx = 2;
    gbc.gridy = 0;
    gbc.weightx = 0.0;
    gbc.anchor = GridBagConstraints.CENTER;
    gbc.insets = new Insets(0, 0, 0, 0);

    statusBar.add(memoryStatus, gbc);
    add(desktop, BorderLayout.CENTER);
    add(statusBar, BorderLayout.SOUTH);

    if (SystemUtils.IS_JAVA_1_6) {
        setSplashStatusText("Creating statistics dialog.");
        if (logger.isDebugEnabled())
            logger.debug("Before creation of statistics-dialog...");
        statisticsDialog = new StatisticsDialog(this);
        if (logger.isDebugEnabled())
            logger.debug("After creation of statistics-dialog...");
    }

    setSplashStatusText("Creating about dialog.");
    aboutDialog = new AboutDialog(this, "About " + appName + "...", appName);

    setSplashStatusText("Creating update dialog.");
    checkForUpdateDialog = new CheckForUpdateDialog(this);

    setSplashStatusText("Creating debug dialog.");
    debugDialog = new DebugDialog(this, this);

    setSplashStatusText("Creating preferences dialog.");
    if (logger.isDebugEnabled())
        logger.debug("Before creation of preferences-dialog...");
    preferencesDialog = new PreferencesDialog(this);
    if (logger.isDebugEnabled())
        logger.debug("After creation of preferences-dialog...");

    setSplashStatusText("Creating \"Open inactive\" dialog.");
    openInactiveLogsDialog = new OpenPreviousDialog(MainFrame.this);

    setSplashStatusText("Creating help frame.");
    helpFrame = new HelpFrame(this);
    helpFrame.setTitle("Help Topics");

    openFileChooser = new JFileChooser();
    openFileChooser.setFileFilter(new LilithFileFilter());
    openFileChooser.setFileHidingEnabled(false);
    openFileChooser.setCurrentDirectory(this.applicationPreferences.getPreviousOpenPath());

    importFileChooser = new JFileChooser();
    importFileChooser.setFileFilter(new XmlImportFileFilter());
    importFileChooser.setFileHidingEnabled(false);
    importFileChooser.setCurrentDirectory(this.applicationPreferences.getPreviousImportPath());

    exportFileChooser = new JFileChooser();
    exportFileChooser.setFileFilter(new LilithFileFilter());
    exportFileChooser.setFileHidingEnabled(false);
    exportFileChooser.setCurrentDirectory(this.applicationPreferences.getPreviousExportPath());

    setSplashStatusText("Creating task manager frame.");
    taskManagerFrame = new TaskManagerInternalFrame(this);
    taskManagerFrame.setTitle("Task Manager");
    taskManagerFrame.setDefaultCloseOperation(JInternalFrame.HIDE_ON_CLOSE);
    taskManagerFrame.setBounds(0, 0, 320, 240);

    desktop.add(taskManagerFrame);
    desktop.validate();

    // the following code must be executed after desktop has been initialized...
    try {
        // try to use the 1.6 transfer handler...
        new MainFrameTransferHandler16(this).attach();
    } catch (Throwable t) {
        // ... and use the basic 1.5 transfer handler if this fails.
        new MainFrameTransferHandler(this).attach();
    }

    setSplashStatusText("Creating Tip of the Day dialog.");
    tipOfTheDayDialog = new TipOfTheDayDialog(this);

    setSplashStatusText("Creating actions and menus.");
    viewActions = new ViewActions(this, null);
    viewActions.getPopupMenu(); // initialize popup once in main frame only.

    JMenuBar menuBar = viewActions.getMenuBar();
    toolbar = viewActions.getToolbar();
    add(toolbar, BorderLayout.NORTH);
    setJMenuBar(menuBar);

    setShowingToolbar(applicationPreferences.isShowingToolbar());
    setShowingStatusbar(applicationPreferences.isShowingStatusbar());
}