@David是对的,因为主机平台拥有这些
Jframe装饰,但是您可以使用这些
JInternalframe图标,这些图标通常可以
概括该平台的图标。例如,
private static final Icon ICON = (Icon) UIManager.get("Internalframe.closeIcon");
其他装饰默认列举
here.
SSCCE:
import java.awt.EventQueue;import java.awt.GridLayout;import javax.swing.BorderFactory;import javax.swing.Icon;import javax.swing.Jframe;import javax.swing.JLabel;import javax.swing.JPanel;import javax.swing.UIManager;public class InternalframeIcons extends JPanel { public InternalframeIcons() { this.setLayout(new GridLayout(0, 1, 5, 5)); this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); this.add(createLabel("Internalframe.closeIcon")); this.add(createLabel("Internalframe.maximizeIcon")); this.add(createLabel("Internalframe.minimizeIcon")); } private JLabel createLabel(String name) { Icon icon = (Icon) UIManager.get(name); JLabel label = new JLabel(name, icon, JLabel.CENTER); label.setHorizontalTextPosition(JLabel.CENTER); label.setVerticalTextPosition(JLabel.BOTTOM); return label; } private void display() { Jframe f = new Jframe("InternalframeIcons"); f.setDefaultCloseOperation(Jframe.EXIT_ON_CLOSE); f.add(this); f.pack(); f.setLocationRelativeTo(null); f.setVisible(true); } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { @Override public void run() { new InternalframeIcons().display(); } }); }}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)