@ -7,8 +7,8 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel ;
import com.fr.design.gui.ilable.UILabel ;
import com.fr.design.gui.itextfield.UITextField ;
import com.fr.design.gui.itextfield.UITextField ;
import com.fr.design.layout.FRGUIPaneFactory ;
import com.fr.design.layout.FRGUIPaneFactory ;
import com.fr.design.utils.DesignUtils ;
import com.fr.design.utils.gui.GUIPaintUtils ;
import com.fr.design.utils.gui.GUIPaintUtils ;
import com.fr.stable.Constants ;
import com.fr.stable.Constants ;
import com.fr.stable.StringUtils ;
import com.fr.stable.StringUtils ;
@ -45,8 +45,8 @@ import java.util.Calendar;
import java.util.Date ;
import java.util.Date ;
public class UICalendarPanel extends JPanel {
public class UICalendarPanel extends JPanel {
private static final Font FONT_SONG = new Font ( com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Basic_Song_TypeFace" ) , 0 , 12 ) ;
private static final Font FONT_UI = DesignUtils . getDefaultGUIFont ( ) . applySize ( 12 ) ;
private static final Font FONT_BLACK = new Font ( com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Basic_Black_Font" ) , 0 , 12 ) ;
private static final Font FONT_BLACK = new Font ( com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Basic_Black_Font" ) , Font . PLAIN , 12 ) ;
private static final int WEEKDAY_COUNT = 7 ;
private static final int WEEKDAY_COUNT = 7 ;
private static final int TOTAL_DAYS_COUNT = 42 ;
private static final int TOTAL_DAYS_COUNT = 42 ;
@ -108,13 +108,13 @@ public class UICalendarPanel extends JPanel {
}
}
// << < yyyy/MM/dd > >>
// << < yyyy/MM/dd > >>
private JPanel createNorthPane ( ) {
private JPanel createNorthPane ( ) {
JPanel pNorth = FRGUIPaneFactory . createX_AXISBoxInnerContainer_S_Pane ( ) ;
JPanel pNorth = FRGUIPaneFactory . createX_AXISBoxInnerContainer_S_Pane ( ) ;
pNorth . setBackground ( new Color ( 0xFFFFFF ) ) ;
pNorth . setBackground ( new Color ( 0xFFFFFF ) ) ;
pNorth . setPreferredSize ( new Dimension ( 1 , 22 ) ) ;
pNorth . setPreferredSize ( new Dimension ( 1 , 22 ) ) ;
pNorth . add ( Box . createHorizontalStrut ( 5 ) ) ;
pNorth . add ( Box . createHorizontalStrut ( 5 ) ) ;
pNorth . add ( createSkipButton ( Calendar . YEAR , - 1 , new Icon [ ] {
pNorth . add ( createSkipButton ( Calendar . YEAR , - 1 , new Icon [ ] {
BaseUtils . readIcon ( "/com/fr/design/images/calender/year_reduce.png" ) ,
BaseUtils . readIcon ( "/com/fr/design/images/calender/year_reduce.png" ) ,
BaseUtils . readIcon ( "/com/fr/design/images/calender/year_reduce_hover.png" ) ,
BaseUtils . readIcon ( "/com/fr/design/images/calender/year_reduce_hover.png" ) ,
BaseUtils . readIcon ( "/com/fr/design/images/calender/year_reduce_click.png" )
BaseUtils . readIcon ( "/com/fr/design/images/calender/year_reduce_click.png" )
@ -130,7 +130,7 @@ public class UICalendarPanel extends JPanel {
monthLabel = new UILabel ( "" , UILabel . CENTER ) ;
monthLabel = new UILabel ( "" , UILabel . CENTER ) ;
monthLabel . setBackground ( new Color ( 0xFFFFFF ) ) ;
monthLabel . setBackground ( new Color ( 0xFFFFFF ) ) ;
monthLabel . setForeground ( new Color ( 0x000000 ) ) ;
monthLabel . setForeground ( new Color ( 0x000000 ) ) ;
monthLabel . setFont ( FONT_SONG ) ;
monthLabel . setFont ( FONT_UI ) ;
pNorth . add ( Box . createHorizontalGlue ( ) ) ;
pNorth . add ( Box . createHorizontalGlue ( ) ) ;
pNorth . add ( monthLabel ) ;
pNorth . add ( monthLabel ) ;
pNorth . add ( Box . createHorizontalGlue ( ) ) ;
pNorth . add ( Box . createHorizontalGlue ( ) ) ;
@ -144,7 +144,7 @@ public class UICalendarPanel extends JPanel {
monthPlus . setHorizontalAlignment ( SwingConstants . RIGHT ) ;
monthPlus . setHorizontalAlignment ( SwingConstants . RIGHT ) ;
pNorth . add ( monthPlus ) ;
pNorth . add ( monthPlus ) ;
pNorth . add ( Box . createHorizontalStrut ( 11 ) ) ;
pNorth . add ( Box . createHorizontalStrut ( 11 ) ) ;
pNorth . add ( createSkipButton ( Calendar . YEAR , 1 , new Icon [ ] {
pNorth . add ( createSkipButton ( Calendar . YEAR , 1 , new Icon [ ] {
BaseUtils . readIcon ( "/com/fr/design/images/calender/year_add.png" ) ,
BaseUtils . readIcon ( "/com/fr/design/images/calender/year_add.png" ) ,
BaseUtils . readIcon ( "/com/fr/design/images/calender/year_add_hover.png" ) ,
BaseUtils . readIcon ( "/com/fr/design/images/calender/year_add_hover.png" ) ,
BaseUtils . readIcon ( "/com/fr/design/images/calender/year_add_click.png" )
BaseUtils . readIcon ( "/com/fr/design/images/calender/year_add_click.png" )
@ -161,9 +161,9 @@ public class UICalendarPanel extends JPanel {
pWeeks . setPreferredSize ( new Dimension ( 216 , 22 ) ) ;
pWeeks . setPreferredSize ( new Dimension ( 216 , 22 ) ) ;
pWeeks . setBackground ( new Color ( 0xFFFFFF ) ) ;
pWeeks . setBackground ( new Color ( 0xFFFFFF ) ) ;
pWeeks . setOpaque ( true ) ;
pWeeks . setOpaque ( true ) ;
String [ ] strWeeks = new String [ ] { StringUtils . EMPTY , com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Chart_Sun" ) , com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Basic_Mon" ) ,
String [ ] strWeeks = new String [ ] { StringUtils . EMPTY , com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Chart_Sun" ) , com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Basic_Mon" ) ,
com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Basic_Tue" ) , com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Basic_Wed" ) , com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Basic_Thu" ) ,
com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Basic_Tue" ) , com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Basic_Wed" ) , com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Basic_Thu" ) ,
com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Basic_Fri" ) , com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Basic_Sat" )
com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Basic_Fri" ) , com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Basic_Sat" )
} ;
} ;
for ( int i = 1 ; i < = WEEKDAY_COUNT ; i + + ) {
for ( int i = 1 ; i < = WEEKDAY_COUNT ; i + + ) {
UILabel label = new UILabel ( ) ;
UILabel label = new UILabel ( ) ;
@ -197,32 +197,32 @@ public class UICalendarPanel extends JPanel {
return pCenter ;
return pCenter ;
}
}
private JPanel createSouthPane ( ) {
private JPanel createSouthPane ( ) {
JPanel sPane = new JPanel ( ) ;
JPanel sPane = new JPanel ( ) ;
sPane . setPreferredSize ( new Dimension ( 216 , 30 ) ) ;
sPane . setPreferredSize ( new Dimension ( 216 , 30 ) ) ;
sPane . setBackground ( Color . WHITE ) ;
sPane . setBackground ( Color . WHITE ) ;
sPane . setLayout ( new FlowLayout ( FlowLayout . LEFT , 0 , 6 ) ) ;
sPane . setLayout ( new FlowLayout ( FlowLayout . LEFT , 0 , 6 ) ) ;
UILabel timeLabel = new UILabel ( com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Report_Time" ) + ":" ) ;
UILabel timeLabel = new UILabel ( com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Report_Time" ) + ":" ) ;
timeLabel . setBorder ( BorderFactory . createEmptyBorder ( 0 , 9 , 0 , 5 ) ) ;
timeLabel . setBorder ( BorderFactory . createEmptyBorder ( 0 , 9 , 0 , 5 ) ) ;
timeLabel . setFont ( FONT_SONG ) ;
timeLabel . setFont ( FONT_UI ) ;
sPane . add ( timeLabel ) ;
sPane . add ( timeLabel ) ;
hms = new HMSPane ( ) ;
hms = new HMSPane ( ) ;
sPane . add ( hms ) ;
sPane . add ( hms ) ;
UILabel gap = new UILabel ( ) ;
UILabel gap = new UILabel ( ) ;
gap . setPreferredSize ( new Dimension ( 26 , 1 ) ) ;
gap . setPreferredSize ( new Dimension ( 26 , 1 ) ) ;
sPane . add ( gap ) ;
sPane . add ( gap ) ;
UIButton okButton = new UIButton ( com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Report_OK" ) ) {
UIButton okButton = new UIButton ( com . fr . design . i18n . Toolkit . i18nText ( "Fine-Design_Report_OK" ) ) {
public Dimension getPreferredSize ( ) {
public Dimension getPreferredSize ( ) {
return new Dimension ( 32 , 18 ) ;
return new Dimension ( 32 , 18 ) ;
}
}
public Insets getInsets ( ) {
public Insets getInsets ( ) {
return new Insets ( 0 , 0 , 0 , 0 ) ;
return new Insets ( 0 , 0 , 0 , 0 ) ;
}
}
} ;
} ;
okButton . setFont ( FONT_SONG ) ;
okButton . setFont ( FONT_UI ) ;
okButton . setVerticalAlignment ( SwingConstants . CENTER ) ;
okButton . setVerticalAlignment ( SwingConstants . CENTER ) ;
okButton . addActionListener ( new ActionListener ( ) {
okButton . addActionListener ( new ActionListener ( ) {
@ -248,11 +248,12 @@ public class UICalendarPanel extends JPanel {
/ * *
/ * *
* 创建上一月 , 下一月 , 上一年 , 下一年 "按钮"
* 创建上一月 , 下一月 , 上一年 , 下一年 "按钮"
* @param field int
*
* @param field int
* @param amount int
* @param amount int
* @return UILabel
* @return UILabel
* /
* /
protected UILabel createSkipButton ( final int field , final int amount , final Icon [ ] icons ) {
protected UILabel createSkipButton ( final int field , final int amount , final Icon [ ] icons ) {
if ( icons . length ! = 3 ) {
if ( icons . length ! = 3 ) {
return new UILabel ( ) ;
return new UILabel ( ) ;
}
}
@ -274,11 +275,11 @@ public class UICalendarPanel extends JPanel {
}
}
public void mouseEntered ( MouseEvent e ) {
public void mouseEntered ( MouseEvent e ) {
label . setIcon ( icons [ 1 ] ) ;
label . setIcon ( icons [ 1 ] ) ;
}
}
public void mouseExited ( MouseEvent e ) {
public void mouseExited ( MouseEvent e ) {
label . setIcon ( icons [ 0 ] ) ;
label . setIcon ( icons [ 0 ] ) ;
}
}
public void mousePressed ( MouseEvent e ) {
public void mousePressed ( MouseEvent e ) {
@ -311,7 +312,7 @@ public class UICalendarPanel extends JPanel {
gp . setBorder ( null ) ;
gp . setBorder ( null ) ;
UIDayLabel label = new UIDayLabel ( setupCalendar . getTime ( ) ) ;
UIDayLabel label = new UIDayLabel ( setupCalendar . getTime ( ) ) ;
label . setHorizontalAlignment ( SwingConstants . RIGHT ) ;
label . setHorizontalAlignment ( SwingConstants . RIGHT ) ;
label . setBorder ( BorderFactory . createEmptyBorder ( 0 , 0 , 0 , 9 ) ) ;
label . setBorder ( BorderFactory . createEmptyBorder ( 0 , 0 , 0 , 9 ) ) ;
label . addMouseListener ( dayBttListener ) ;
label . addMouseListener ( dayBttListener ) ;
if ( "1" . equals ( label . getText ( ) ) ) {
if ( "1" . equals ( label . getText ( ) ) ) {
isCurrentMonth = ! isCurrentMonth ;
isCurrentMonth = ! isCurrentMonth ;
@ -328,7 +329,7 @@ public class UICalendarPanel extends JPanel {
days . setSelectedIndex ( i ) ;
days . setSelectedIndex ( i ) ;
this . selectedDate = label . getDate ( ) ;
this . selectedDate = label . getDate ( ) ;
this . calendar . setTime ( this . selectedDate ) ;
this . calendar . setTime ( this . selectedDate ) ;
} else {
} else {
gp . add ( label , BorderLayout . CENTER ) ;
gp . add ( label , BorderLayout . CENTER ) ;
days . add ( gp ) ;
days . add ( gp ) ;
}
}
@ -337,7 +338,7 @@ public class UICalendarPanel extends JPanel {
}
}
public void updateHMS ( ) {
public void updateHMS ( ) {
if ( hms ! = null ) {
if ( hms ! = null ) {
hms . populate ( this . calendar ) ;
hms . populate ( this . calendar ) ;
hms . validate ( ) ;
hms . validate ( ) ;
}
}
@ -388,9 +389,9 @@ public class UICalendarPanel extends JPanel {
public void mousePressed ( MouseEvent e ) {
public void mousePressed ( MouseEvent e ) {
if ( isEnabled ( ) ) {
if ( isEnabled ( ) ) {
UIDayLabel com = ( UIDayLabel ) e . getComponent ( ) ;
UIDayLabel com = ( UIDayLabel ) e . getComponent ( ) ;
GradientPane gp = ( GradientPane ) com . getParent ( ) ;
GradientPane gp = ( GradientPane ) com . getParent ( ) ;
if ( days . selectedIndex ! = - 1 ) {
if ( days . selectedIndex ! = - 1 ) {
( ( GradientPane ) days . getComponent ( days . selectedIndex ) ) . setGradientBackground ( new GradientBackground ( new Color ( 0xFEFEFE ) , new Color ( 0xF3F2F3 ) , GradientBackground . TOP2BOTTOM ) ) ;
( ( GradientPane ) days . getComponent ( days . selectedIndex ) ) . setGradientBackground ( new GradientBackground ( new Color ( 0xFEFEFE ) , new Color ( 0xF3F2F3 ) , GradientBackground . TOP2BOTTOM ) ) ;
}
}
gp . setGradientBackground ( new GradientBackground ( new Color ( 0x097BD9 ) , new Color ( 0x41A3EE ) , GradientBackground . TOP2BOTTOM ) ) ;
gp . setGradientBackground ( new GradientBackground ( new Color ( 0x097BD9 ) , new Color ( 0x41A3EE ) , GradientBackground . TOP2BOTTOM ) ) ;
days . setSelectedIndex ( gp . getIndex ( ) ) ;
days . setSelectedIndex ( gp . getIndex ( ) ) ;
@ -413,7 +414,7 @@ public class UICalendarPanel extends JPanel {
public void mouseEntered ( MouseEvent e ) {
public void mouseEntered ( MouseEvent e ) {
if ( isEnabled ( ) ) {
if ( isEnabled ( ) ) {
JComponent com = ( JComponent ) e . getComponent ( ) ;
JComponent com = ( JComponent ) e . getComponent ( ) ;
GradientPane gp = ( GradientPane ) com . getParent ( ) ;
GradientPane gp = ( GradientPane ) com . getParent ( ) ;
if ( gp . getIndex ( ) = = days . selectedIndex ) {
if ( gp . getIndex ( ) = = days . selectedIndex ) {
return ;
return ;
}
}
@ -426,7 +427,7 @@ public class UICalendarPanel extends JPanel {
public void mouseExited ( MouseEvent e ) {
public void mouseExited ( MouseEvent e ) {
if ( isEnabled ( ) ) {
if ( isEnabled ( ) ) {
JComponent com = ( JComponent ) e . getComponent ( ) ;
JComponent com = ( JComponent ) e . getComponent ( ) ;
GradientPane gp = ( GradientPane ) com . getParent ( ) ;
GradientPane gp = ( GradientPane ) com . getParent ( ) ;
if ( gp . getIndex ( ) ! = days . selectedIndex ) {
if ( gp . getIndex ( ) ! = days . selectedIndex ) {
gp . setGradientBackground ( new GradientBackground ( new Color ( 0xFEFEFE ) , new Color ( 0xF3F2F3 ) , GradientBackground . TOP2BOTTOM ) ) ;
gp . setGradientBackground ( new GradientBackground ( new Color ( 0xFEFEFE ) , new Color ( 0xF3F2F3 ) , GradientBackground . TOP2BOTTOM ) ) ;
}
}
@ -489,7 +490,7 @@ public class UICalendarPanel extends JPanel {
this . isGradientBackground = isGradientBackground ;
this . isGradientBackground = isGradientBackground ;
}
}
public void paint ( Graphics g ) {
public void paint ( Graphics g ) {
super . paint ( g ) ;
super . paint ( g ) ;
if ( isGradientBackground & & gradientBackground ! = null ) {
if ( isGradientBackground & & gradientBackground ! = null ) {
gradientBackground . paint ( g , new Rectangle ( this . getWidth ( ) , this . getHeight ( ) ) ) ;
gradientBackground . paint ( g , new Rectangle ( this . getWidth ( ) , this . getHeight ( ) ) ) ;
@ -509,7 +510,7 @@ public class UICalendarPanel extends JPanel {
this . index = i ;
this . index = i ;
}
}
public int getIndex ( ) {
public int getIndex ( ) {
return this . index ;
return this . index ;
}
}
@ -530,12 +531,12 @@ public class UICalendarPanel extends JPanel {
public DayPane ( ) {
public DayPane ( ) {
floateIndex = - 1 ;
floateIndex = - 1 ;
selectedIndex = - 1 ;
selectedIndex = - 1 ;
this . setLayout ( new GridLayout ( 6 , 7 , 1 , 1 ) ) ;
this . setLayout ( new GridLayout ( 6 , 7 , 1 , 1 ) ) ;
this . setBackground ( new Color ( 0xFFFFFF ) ) ;
this . setBackground ( new Color ( 0xFFFFFF ) ) ;
this . setBorder ( BorderFactory . createMatteBorder ( 1 , 0 , 1 , 0 , new Color ( 0xDADADA ) ) ) ;
this . setBorder ( BorderFactory . createMatteBorder ( 1 , 0 , 1 , 0 , new Color ( 0xDADADA ) ) ) ;
}
}
public void paint ( Graphics g ) {
public void paint ( Graphics g ) {
super . paint ( g ) ;
super . paint ( g ) ;
int width = 31 ;
int width = 31 ;
int height = 19 ;
int height = 19 ;
@ -543,11 +544,11 @@ public class UICalendarPanel extends JPanel {
g . setColor ( new Color ( 0xDADADA ) ) ;
g . setColor ( new Color ( 0xDADADA ) ) ;
int start_x = 30 ;
int start_x = 30 ;
int start_y = 19 ;
int start_y = 19 ;
for ( int i = 0 ; i < 6 ; i + + ) {
for ( int i = 0 ; i < 6 ; i + + ) {
g . drawLine ( start_x , 0 , start_x , getHeight ( ) ) ;
g . drawLine ( start_x , 0 , start_x , getHeight ( ) ) ;
start_x + = width ;
start_x + = width ;
}
}
for ( int i = 0 ; i < 5 ; i + + ) {
for ( int i = 0 ; i < 5 ; i + + ) {
g . drawLine ( 0 , start_y , getWidth ( ) , start_y ) ;
g . drawLine ( 0 , start_y , getWidth ( ) , start_y ) ;
start_y + = height ;
start_y + = height ;
}
}
@ -558,25 +559,25 @@ public class UICalendarPanel extends JPanel {
}
}
if ( selectedIndex > - 1 ) {
if ( selectedIndex > - 1 ) {
g . setColor ( selectedColor ) ;
g . setColor ( selectedColor ) ;
paintChindPane ( g , selectedIndex ) ;
paintChindPane ( g , selectedIndex ) ;
}
}
g . setColor ( oldColor ) ;
g . setColor ( oldColor ) ;
}
}
private void paintChindPane ( Graphics g , int index ) {
private void paintChindPane ( Graphics g , int index ) {
if ( index % 7 = = 0 ) {
if ( index % 7 = = 0 ) {
int y1 = index / 7 * 19 ;
int y1 = index / 7 * 19 ;
g . drawLine ( 0 , y1 , 30 , y1 ) ;
g . drawLine ( 0 , y1 , 30 , y1 ) ;
g . drawLine ( 0 , y1 + 19 , 30 , y1 + 19 ) ;
g . drawLine ( 0 , y1 + 19 , 30 , y1 + 19 ) ;
g . drawLine ( 30 , y1 , 30 , y1 + 19 ) ;
g . drawLine ( 30 , y1 , 30 , y1 + 19 ) ;
} else if ( index % 7 = = 6 ) {
} else if ( index % 7 = = 6 ) {
int y1 = index / 7 * 19 ;
int y1 = index / 7 * 19 ;
g . drawLine ( 185 , y1 , 216 , y1 ) ;
g . drawLine ( 185 , y1 , 216 , y1 ) ;
g . drawLine ( 185 , y1 + 19 , 216 , y1 + 19 ) ;
g . drawLine ( 185 , y1 + 19 , 216 , y1 + 19 ) ;
g . drawLine ( 185 , y1 , 185 , y1 + 19 ) ;
g . drawLine ( 185 , y1 , 185 , y1 + 19 ) ;
} else {
} else {
int x1 = index % 7 * 31 - 1 ;
int x1 = index % 7 * 31 - 1 ;
int y1 = index / 7 * 19 ;
int y1 = index / 7 * 19 ;
g . drawRect ( x1 , y1 , 31 , 19 ) ;
g . drawRect ( x1 , y1 , 31 , 19 ) ;
}
}
}
}
@ -599,7 +600,7 @@ public class UICalendarPanel extends JPanel {
}
}
private class HMSPane extends JPanel {
private class HMSPane extends JPanel {
private boolean isRolOver ;
private boolean isRolOver ;
private UIButton preButton ;
private UIButton preButton ;
private UIButton nextButton ;
private UIButton nextButton ;
@ -608,7 +609,7 @@ public class UICalendarPanel extends JPanel {
private CalendarNumberField sField ;
private CalendarNumberField sField ;
private CalendarNumberField selectedNumberField ;
private CalendarNumberField selectedNumberField ;
public HMSPane ( ) {
public HMSPane ( ) {
this . setPreferredSize ( new Dimension ( 101 , 18 ) ) ;
this . setPreferredSize ( new Dimension ( 101 , 18 ) ) ;
this . setLayout ( new BorderLayout ( 0 , 0 ) ) ;
this . setLayout ( new BorderLayout ( 0 , 0 ) ) ;
this . setBackground ( null ) ;
this . setBackground ( null ) ;
@ -633,7 +634,7 @@ public class UICalendarPanel extends JPanel {
}
}
private void initComponents ( ) {
private void initComponents ( ) {
JPanel jp = new JPanel ( new FlowLayout ( FlowLayout . LEFT , 0 , 2 ) ) ;
JPanel jp = new JPanel ( new FlowLayout ( FlowLayout . LEFT , 0 , 2 ) ) ;
jp . setBackground ( null ) ;
jp . setBackground ( null ) ;
jp . setBorder ( null ) ;
jp . setBorder ( null ) ;
@ -649,13 +650,13 @@ public class UICalendarPanel extends JPanel {
jp . add ( sField ) ;
jp . add ( sField ) ;
this . add ( jp , BorderLayout . CENTER ) ;
this . add ( jp , BorderLayout . CENTER ) ;
preButton = new UIButton ( UIConstants . ARROW_UP_ICON ) {
preButton = new UIButton ( UIConstants . ARROW_UP_ICON ) {
public boolean shouldResponseChangeListener ( ) {
public boolean shouldResponseChangeListener ( ) {
return false ;
return false ;
}
}
} ;
} ;
preButton . setRoundBorder ( true , Constants . LEFT ) ;
preButton . setRoundBorder ( true , Constants . LEFT ) ;
nextButton = new UIButton ( UIConstants . ARROW_DOWN_ICON ) {
nextButton = new UIButton ( UIConstants . ARROW_DOWN_ICON ) {
public boolean shouldResponseChangeListener ( ) {
public boolean shouldResponseChangeListener ( ) {
return false ;
return false ;
}
}
@ -673,7 +674,7 @@ public class UICalendarPanel extends JPanel {
MouseAdapter backgroundAdapter = new MouseAdapter ( ) {
MouseAdapter backgroundAdapter = new MouseAdapter ( ) {
@Override
@Override
public void mousePressed ( MouseEvent e ) {
public void mousePressed ( MouseEvent e ) {
HMSPane . this . selectedNumberField = ( CalendarNumberField ) e . getComponent ( ) ;
HMSPane . this . selectedNumberField = ( CalendarNumberField ) e . getComponent ( ) ;
}
}
@Override
@Override
@ -710,17 +711,17 @@ public class UICalendarPanel extends JPanel {
} ) ;
} ) ;
}
}
private UILabel createGapLabel ( ) {
private UILabel createGapLabel ( ) {
UILabel uiLabel = new UILabel ( ":" ) ;
UILabel uiLabel = new UILabel ( ":" ) ;
uiLabel . setHorizontalAlignment ( SwingConstants . CENTER ) ;
uiLabel . setHorizontalAlignment ( SwingConstants . CENTER ) ;
uiLabel . setBackground ( null ) ;
uiLabel . setBackground ( null ) ;
uiLabel . setBorder ( null ) ;
uiLabel . setBorder ( null ) ;
uiLabel . setPreferredSize ( new Dimension ( 6 , 10 ) ) ;
uiLabel . setPreferredSize ( new Dimension ( 6 , 10 ) ) ;
return uiLabel ;
return uiLabel ;
}
}
public Insets getInsets ( ) {
public Insets getInsets ( ) {
return new Insets ( 1 , 3 , 1 , 0 ) ;
return new Insets ( 1 , 3 , 1 , 0 ) ;
}
}
public void paint ( Graphics g ) {
public void paint ( Graphics g ) {
@ -729,7 +730,7 @@ public class UICalendarPanel extends JPanel {
}
}
public void paintBorder ( Graphics g ) {
public void paintBorder ( Graphics g ) {
Graphics2D g2d = ( Graphics2D ) g ;
Graphics2D g2d = ( Graphics2D ) g ;
if ( isRolOver ) {
if ( isRolOver ) {
Shape shape = new RoundRectangle2D . Double ( 1 , 1 , 86 , 15 , UIConstants . ARC , UIConstants . ARC ) ;
Shape shape = new RoundRectangle2D . Double ( 1 , 1 , 86 , 15 , UIConstants . ARC , UIConstants . ARC ) ;
GUIPaintUtils . paintBorderShadow ( g2d , 3 , shape , UIConstants . HOVER_BLUE , Color . WHITE ) ;
GUIPaintUtils . paintBorderShadow ( g2d , 3 , shape , UIConstants . HOVER_BLUE , Color . WHITE ) ;
@ -738,7 +739,7 @@ public class UICalendarPanel extends JPanel {
}
}
}
}
public void populate ( Calendar calendar ) {
public void populate ( Calendar calendar ) {
this . hField . setValue ( calendar . get ( Calendar . HOUR_OF_DAY ) ) ;
this . hField . setValue ( calendar . get ( Calendar . HOUR_OF_DAY ) ) ;
this . mField . setValue ( calendar . get ( Calendar . MINUTE ) ) ;
this . mField . setValue ( calendar . get ( Calendar . MINUTE ) ) ;
this . sField . setValue ( calendar . get ( Calendar . SECOND ) ) ;
this . sField . setValue ( calendar . get ( Calendar . SECOND ) ) ;
@ -751,15 +752,15 @@ public class UICalendarPanel extends JPanel {
}
}
}
}
public static void main ( String [ ] args ) {
public static void main ( String [ ] args ) {
JFrame frame = new JFrame ( ) ;
JFrame frame = new JFrame ( ) ;
UICalendarPanel calendarPanel = new UICalendarPanel ( ) ;
UICalendarPanel calendarPanel = new UICalendarPanel ( ) ;
final UITextField field = new UITextField ( ) ;
final UITextField field = new UITextField ( ) ;
field . setPreferredSize ( new Dimension ( 120 , 25 ) ) ;
field . setPreferredSize ( new Dimension ( 120 , 25 ) ) ;
calendarPanel . addDateChangeListener ( new ChangeListener ( ) {
calendarPanel . addDateChangeListener ( new ChangeListener ( ) {
public void stateChanged ( ChangeEvent e ) {
public void stateChanged ( ChangeEvent e ) {
Date selectedDate = ( Date ) e . getSource ( ) ;
Date selectedDate = ( Date ) e . getSource ( ) ;
SimpleDateFormat f = new SimpleDateFormat ( "yyyy/MM/dd" ) ;
SimpleDateFormat f = new SimpleDateFormat ( "yyyy/MM/dd" ) ;
field . setText ( f . format ( selectedDate ) ) ;
field . setText ( f . format ( selectedDate ) ) ;
}
}