2
A
回答
2
你可以设置一个JButton
的背景图像,你可以看看这个:Swing Tutorial: JButton这表明使用new JButton(String text,ImageIcon imgIco)
的创建具有ImageIcon
和String
一个JButton
。
要设置背景颜色和文字,你可以使用setBackground(Color c)
和setForeground(Color c)
或
或者只是定制外观和设置适当的支持Look and Feel然后change the color scheme/size etc of its components thier数以百计的事情感到配色方案您可以更改每个组件,详见this。
要定制的退出,最小化和最大化工具栏按钮,这也可以通过外观(Custom design for Close/Minimize buttons on JFrame):
import java.awt.BorderLayout;
import javax.swing.*;
public class FrameCloseButtonsByLookAndFeel {
FrameCloseButtonsByLookAndFeel() {
String[] names = {
UIManager.getSystemLookAndFeelClassName(),
UIManager.getCrossPlatformLookAndFeelClassName()
};
for (String name : names) {
try {
UIManager.setLookAndFeel(name);
} catch (Exception e) {
e.printStackTrace();
}
// very important to get the window decorations.
JFrame.setDefaultLookAndFeelDecorated(true);
JFrame f = new JFrame(UIManager.getLookAndFeel().getName());
f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
JPanel gui = new JPanel(new BorderLayout());
f.setContentPane(gui);
JTree tree = new JTree();
tree.setVisibleRowCount(4);
gui.add(tree, BorderLayout.LINE_START);
gui.add(new JScrollPane(new JTextArea(3,15)));
JToolBar toolbar = new JToolBar();
gui.add(toolbar, BorderLayout.PAGE_START);
for (int ii=1; ii<5; ii++) {
toolbar.add(new JButton("Button " + ii));
if (ii%2==0) {
toolbar.addSeparator();
}
}
f.pack();
f.setLocationByPlatform(true);
f.setVisible(true);
}
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
new FrameCloseButtonsByLookAndFeel();
}
});
}
}
0
嘛更改框架标题栏外观的最简单方法是在创建框架之前设置LookAndFeel。 也许这就是你要找的 - http://www.jtattoo.net/ScreenShots.html
相关问题
- 1. Win7标题栏顶部的黑色图层(最小化/最大化/关闭)
- 2. 更改窗口图标的最小化,关闭并最大化
- 3. 的Windows 10关闭,最小化和最大化按键
- 4. c#最大化,最小化和关闭窗体上的按钮
- 5. C#自定义关闭,最小化和最大化按钮
- 6. 窗体在关闭,最小化或最大化时挂起
- 7. XAML通过SystemCommands最小化/最大化/关闭按钮
- 8. Qt隐藏最小化,最大化和关闭按钮
- 9. Metro UI风格关闭/最小化/最大化按钮
- 10. 如何检索窗口最小化,最大化和关闭按钮的大小?
- 11. 最大化,最小化和关闭网页中每个部分的按钮
- 12. SetWindowsHookEx并单击窗体冻结时的最小化/最大化/关闭按钮
- 13. 最小化/最大化div
- 14. Java Swing JFrame最小化/最大化调整大小错误
- 15. Electron v1.7:关闭,最大化和最大化
- 16. 如何使自定义关闭/最小化/最大化菜单停靠在右侧/左侧窗口10屏幕
- 17. 最小化/最大化/关闭按钮的工具提示和DevExpress的LookAndFeel都
- 18. 获取默认的Windows系统图标的最小化,最大化和关闭
- 19. 如何调整,最小化,最大化或关闭MVVM WPF中的窗口?
- 20. 隐藏最大化/最小化和关闭按钮的Matlab图形窗口
- 21. 如何渲染窗口关闭/最大化/最小化wpf中的按钮?
- 22. 最大化,最小化ExtJS的面板
- 23. 最小化,最大化exe的
- 24. 我如何删除最大化,最小化和关闭图标在MDI Menustrip
- 25. 功能区控制显示Windows 2000最小化/最大化/关闭按钮
- 26. 如何在DXRibbonWindow最大化时关闭,恢复或最小化DXRibbonWindow?
- 27. 最小化最大成本
- 28. 最大化最小差异
- 29. UIPanGestureRecognizer最大化和最小化UIView
- 30. 最小化最大化不工作