Package com.ronald.gantengtimesheet.ui.util

Source Code of com.ronald.gantengtimesheet.ui.util.Util

package com.ronald.gantengtimesheet.ui.util;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.LayoutManager;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;

import javax.swing.BoxLayout;

import org.jdesktop.swingx.JXPanel;

public final class Util {
  private Util() {}
 
  public static JXPanel createPanel(final LayoutManager manager, final Component... components) {
    final JXPanel panel = new JXPanel();
    panel.setLayout(manager);
   
    for (final Component c : components) {
      panel.add(c);
    }
    return panel;
  }
 
  public static JXPanel createBoxLayoutPanel(final int axis, final Component... components) {
    final JXPanel panel = new JXPanel();
    panel.setLayout(new BoxLayout(panel, axis));
   
    for (final Component c : components) {
      panel.add(c);
    }
    return panel;
  }
 
  public static final SimpleDateFormat DateFormat = new SimpleDateFormat("dd MMM yyyy");
  public static final SimpleDateFormat ReverseDateFormat = new SimpleDateFormat("yyyyMMdd");
  public static final SimpleDateFormat ReverseDateDashFormat = new SimpleDateFormat("yyyy-MM-dd");
  public static final SimpleDateFormat DateFormatDash = new SimpleDateFormat("dd-MM-yyyy");
  public static final SimpleDateFormat ReportDateFormat = new SimpleDateFormat("dd MMM yyyy");
  public static final DecimalFormat DecimalFormat = new DecimalFormat("#,##0.00");
  public static final DecimalFormat CurrencyFormat = new DecimalFormat("\u00A4#,##0.00");
 
  public static void setFixedSize(final Component component, final Dimension dimension) {
    component.setMinimumSize(dimension);
    component.setPreferredSize(dimension);
    component.setMaximumSize(dimension);
  }
}
TOP

Related Classes of com.ronald.gantengtimesheet.ui.util.Util

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.