Search in sources :

Example 86 with DateFormatSymbols

use of java.text.DateFormatSymbols in project processdash by dtuma.

the class TimeCardDialog method buildTopPanel.

private Component buildTopPanel() {
    Box result = Box.createHorizontalBox();
    result.add(new JLabel(resources.getString("Time_Card.Month_Label") + " "));
    // We have to build our own month name array because the "official"
    // one contains 13 month names, the last one empty for Gregorian
    // Calendars
    String[] monthNames = new String[12];
    String[] officialMonthNames = (new DateFormatSymbols()).getMonths();
    for (int i = 12; i-- > 0; ) monthNames[i] = officialMonthNames[i];
    monthField = new JComboBox(monthNames);
    dontGrow(monthField);
    monthField.setSelectedIndex(model.getMonth() - Calendar.JANUARY);
    monthField.setMaximumRowCount(12);
    result.add(monthField);
    monthField.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            recalc();
        }
    });
    yearField = new JTextField(5);
    dontGrow(yearField);
    yearField.setText(Integer.toString(model.getYear()));
    result.add(yearField);
    yearField.getDocument().addDocumentListener(new DocumentListener() {

        public void insertUpdate(DocumentEvent e) {
            recalc();
        }

        public void removeUpdate(DocumentEvent e) {
            recalc();
        }

        public void changedUpdate(DocumentEvent e) {
            recalc();
        }
    });
    result.add(Box.createHorizontalGlue());
    result.add(new JLabel(resources.getString("Time_Format.Label") + " "));
    formatType = new JComboBox();
    formatType.addItem(format(75, HOURS_MINUTES));
    formatType.addItem(format(75, HOURS));
    formatType.addItem(format(75, MINUTES));
    dontGrow(formatType);
    result.add(formatType);
    formatType.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            redraw();
        }
    });
    result.add(Box.createHorizontalGlue());
    hideColumns = new JCheckBox();
    result.add(new JLabel(" " + resources.getString("Time_Card.Hide_Empty_Columns_Label") + " "));
    result.add(hideColumns);
    hideColumns.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            resizeColumns();
        }
    });
    result.add(Box.createHorizontalGlue());
    JButton closeButton = new JButton(resources.getString("Close"));
    dontGrow(closeButton);
    result.add(Box.createVerticalStrut(closeButton.getPreferredSize().height + 4));
    result.add(closeButton);
    closeButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            frame.setVisible(false);
        }
    });
    return result;
}
Also used : DocumentListener(javax.swing.event.DocumentListener) JComboBox(javax.swing.JComboBox) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) JComboBox(javax.swing.JComboBox) Box(javax.swing.Box) JCheckBox(javax.swing.JCheckBox) JTextField(javax.swing.JTextField) DocumentEvent(javax.swing.event.DocumentEvent) JCheckBox(javax.swing.JCheckBox) ActionListener(java.awt.event.ActionListener) DateFormatSymbols(java.text.DateFormatSymbols)

Example 87 with DateFormatSymbols

use of java.text.DateFormatSymbols in project processdash by dtuma.

the class TimeLogEditor method createWeekFilterStartDaySubmenu.

private JMenuItem createWeekFilterStartDaySubmenu() {
    int filterStartDay = getWeekFilterStartDay(Calendar.getInstance());
    String[] dayNames = new DateFormatSymbols().getWeekdays();
    JMenu submenu = new JMenu();
    for (int day = 1; day <= 7; day++) submenu.add(new WeekFilterStartDayOption(submenu, dayNames, day, filterStartDay));
    submenu.setFont(submenu.getFont().deriveFont(submenu.getFont().getSize2D() * 0.8f));
    return submenu;
}
Also used : DateFormatSymbols(java.text.DateFormatSymbols) JMenu(javax.swing.JMenu)

Aggregations

DateFormatSymbols (java.text.DateFormatSymbols)87 SimpleDateFormat (java.text.SimpleDateFormat)29 Date (java.util.Date)23 Locale (java.util.Locale)15 Resources (android.content.res.Resources)12 ArrayList (java.util.ArrayList)10 View (android.view.View)9 TextView (android.widget.TextView)8 OnClickListener (android.view.View.OnClickListener)6 Calendar (java.util.Calendar)6 GregorianCalendar (java.util.GregorianCalendar)6 RelativeLayout (android.widget.RelativeLayout)5 Test (org.junit.Test)5 LayoutParams (android.app.ActionBar.LayoutParams)4 Typeface (android.graphics.Typeface)4 List (java.util.List)4 TypedArray (android.content.res.TypedArray)3 ByteArrayInputStream (java.io.ByteArrayInputStream)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 ObjectInputStream (java.io.ObjectInputStream)3