47 |
import java.awt.Graphics; |
import java.awt.Graphics; |
48 |
import java.awt.Insets; |
import java.awt.Insets; |
49 |
import java.awt.LayoutManager; |
import java.awt.LayoutManager; |
|
import java.awt.Polygon; |
|
50 |
import java.awt.Rectangle; |
import java.awt.Rectangle; |
51 |
import java.awt.event.ActionEvent; |
import java.awt.event.ActionEvent; |
52 |
import java.awt.event.KeyEvent; |
import java.awt.event.KeyEvent; |
513 |
/** The button that maximizes the JInternalFrame. */ |
/** The button that maximizes the JInternalFrame. */ |
514 |
protected JButton maxButton; |
protected JButton maxButton; |
515 |
|
|
|
/** Active background color. */ |
|
|
protected Color activeBGColor; |
|
|
|
|
|
/** Active foreground color. */ |
|
|
protected Color activeFGColor; |
|
|
|
|
|
/** Inactive background color. */ |
|
|
protected Color inactiveBGColor; |
|
|
|
|
|
/** Inactive foreground color. */ |
|
|
protected Color inactiveFGColor; |
|
|
|
|
516 |
/** The icon displayed in the restore button. */ |
/** The icon displayed in the restore button. */ |
517 |
protected Icon minIcon = BasicIconFactory.createEmptyFrameIcon(); |
protected Icon minIcon = BasicIconFactory.createEmptyFrameIcon(); |
518 |
|
|
667 |
UIDefaults defaults = UIManager.getLookAndFeelDefaults(); |
UIDefaults defaults = UIManager.getLookAndFeelDefaults(); |
668 |
|
|
669 |
setFont(defaults.getFont("InternalFrame.titleFont")); |
setFont(defaults.getFont("InternalFrame.titleFont")); |
670 |
activeFGColor = defaults.getColor("InternalFrame.activeTitleForeground"); |
selectedTextColor = defaults.getColor("InternalFrame.activeTitleForeground"); |
671 |
activeBGColor = defaults.getColor("InternalFrame.activeTitleBackground"); |
selectedTitleColor = defaults.getColor("InternalFrame.activeTitleBackground"); |
672 |
inactiveFGColor = defaults.getColor("InternalFrame.inactiveTitleForeground"); |
notSelectedTextColor = defaults.getColor("InternalFrame.inactiveTitleForeground"); |
673 |
inactiveBGColor = defaults.getColor("InternalFrame.inactiveTitleBackground"); |
notSelectedTitleColor = defaults.getColor("InternalFrame.inactiveTitleBackground"); |
674 |
} |
} |
675 |
|
|
676 |
/** |
/** |
679 |
protected void uninstallDefaults() |
protected void uninstallDefaults() |
680 |
{ |
{ |
681 |
setFont(null); |
setFont(null); |
682 |
activeFGColor = null; |
selectedTextColor = null; |
683 |
activeBGColor = null; |
selectedTitleColor = null; |
684 |
inactiveFGColor = null; |
notSelectedTextColor = null; |
685 |
inactiveBGColor = null; |
notSelectedTitleColor = null; |
686 |
} |
} |
687 |
|
|
688 |
/** |
/** |
702 |
} |
} |
703 |
|
|
704 |
/** |
/** |
705 |
* This method sets the icons in the buttons. This is a no-op method here, it |
* Set icons for the minimize-, maximize- and close-buttons. |
|
* can be overridden by subclasses to set icons for the minimize-, maximize- |
|
|
* and close-buttons. |
|
706 |
*/ |
*/ |
707 |
protected void setButtonIcons() |
protected void setButtonIcons() |
708 |
{ |
{ |
709 |
|
Icon icon = UIManager.getIcon("InternalFrame.closeIcon"); |
710 |
|
if (icon != null) |
711 |
|
closeButton.setIcon(icon); |
712 |
|
icon = UIManager.getIcon("InternalFrame.iconifyIcon"); |
713 |
|
if (icon != null) |
714 |
|
iconButton.setIcon(icon); |
715 |
|
icon = UIManager.getIcon("InternalFrame.maximizeIcon"); |
716 |
|
if (icon != null) |
717 |
|
maxButton.setIcon(icon); |
718 |
} |
} |
719 |
|
|
720 |
/** |
/** |
822 |
{ |
{ |
823 |
Color saved = g.getColor(); |
Color saved = g.getColor(); |
824 |
if (frame.isSelected()) |
if (frame.isSelected()) |
825 |
g.setColor(activeFGColor); |
g.setColor(selectedTextColor); |
826 |
else |
else |
827 |
g.setColor(inactiveFGColor); |
g.setColor(notSelectedTextColor); |
828 |
title.setText(getTitle(frame.getTitle(), fm, title.getBounds().width)); |
title.setText(getTitle(frame.getTitle(), fm, title.getBounds().width)); |
829 |
SwingUtilities.paintComponent(g, title, null, title.getBounds()); |
SwingUtilities.paintComponent(g, title, null, title.getBounds()); |
830 |
g.setColor(saved); |
g.setColor(saved); |
843 |
|
|
844 |
Color bg = getBackground(); |
Color bg = getBackground(); |
845 |
if (frame.isSelected()) |
if (frame.isSelected()) |
846 |
bg = activeBGColor; |
bg = selectedTitleColor; |
847 |
else |
else |
848 |
bg = inactiveBGColor; |
bg = notSelectedTitleColor; |
849 |
g.setColor(bg); |
g.setColor(bg); |
850 |
g.fillRect(0, 0, dims.width, dims.height); |
g.fillRect(0, 0, dims.width, dims.height); |
851 |
g.setColor(saved); |
g.setColor(saved); |