怎样才能做一个这样的图形界面呢?这个界面看起来比较舒服. 有没有什么资料可以共同分享的 .
----------------解决方案--------------------------------------------------------
图形界面的问题就要请教千里冰封了
----------------解决方案--------------------------------------------------------
这是JAVA里面的lookandFeel,有很多种,你可以选择下载
这就是JAVA的优势地方,可以在不改代码的情况下,使用不同的外观
----------------解决方案--------------------------------------------------------
也算是mvc的思想了
----------------解决方案--------------------------------------------------------
能给个下载地址吗?
----------------解决方案--------------------------------------------------------
以前弄得一个小程序,不过这里面的界面样式似乎也不漂亮!
不知道你上面的图形到底用的哪一个?
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
public class LookAndFeelTest extends JFrame
{
public int a = 0;
public int b = 0;
public LookAndFeelTest()
{
super("多种窗口显示事例");
Container con = getContentPane();
JPanel jp = new JPanel();
JPanel jp1 = new JPanel();
JPanel jp2 = new JPanel();
JPanel jp3 = new JPanel();
JMenuBar jbar = new JMenuBar();
JMenu jmenu = new JMenu("窗口风格");
JMenuItem jitem1 = new JMenuItem("系统平台风格");
JMenuItem jitem2 = new JMenuItem("Motif风格");
JMenuItem jitem3 = new JMenuItem("跨平台风格");
jitem1.addActionListener(new AL());
jitem2.addActionListener(new AL());
jitem3.addActionListener(new AL());
jmenu.add(jitem1);
jmenu.add(jitem2);
jmenu.add(jitem3);
jbar.add(jmenu);
setJMenuBar(jbar);
final JLabel jla = new JLabel("输入文本:");
final JTextField jtext = new JTextField("文本框LookAndFeel测试");
jp1.add(jla);
jp1.add(jtext);
final JCheckBox jc1 = new JCheckBox("粗体");
final JCheckBox jc2 = new JCheckBox("斜体");
final JCheckBox jc3 = new JCheckBox("下划线");
jc1.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
if(jc1.isSelected()) a = 1;
else
a = 0;
}
});
jc2.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
if(jc2.isSelected()) b = 2;
else
b = 0;
}
});
jc3.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
if(jc3.isSelected())
{
jla.setText("<html><u>"+jla.getText()+"</u></html>");
}
else
//jla.setText("<html>"+jla.getText()+"</html>");//JTextField不能这样来设置
jla.setText(jla.getText().substring(9, jla.getText().length()-11));
}
});
jp2.setLayout(new GridLayout(1,3));
jp2.add(jc1);
jp2.add(jc2);
jp2.add(jc3);
JButton jb1 = new JButton("改变字体");
jb1.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
String str = jtext.getText();
Font font = new Font("宋体",a+b,18);
jtext.setFont(font);
jtext.setText(str);
}});
JButton jb2= new JButton("退出");
jb2.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
System.exit(0);
}});
jp3.add(jb1);
jp3.add(jb2);
jp.setLayout(new BorderLayout());
jp.add(jp1,BorderLayout.NORTH);
jp.add(jp2,BorderLayout.CENTER);
jp.add(jp3,BorderLayout.SOUTH);
jp.setBorder(BorderFactory.createTitledBorder("组件样式"));
con.add(jp);
setBackground(Color.white);
setSize(300,200);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
class AL implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
if(e.getActionCommand().equals("系统平台风格"))
{
try
{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch(Exception ec)
{
ec.printStackTrace();
}
}
else if (e.getActionCommand().equals("Motif风格"))
{
try
{
UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
}
catch(Exception ec)
{
ec.printStackTrace();
}
}
else
{
try
{
UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
}
catch(Exception ec)
{
ec.printStackTrace();
}
}
javax.swing.SwingUtilities.updateComponentTreeUI(LookAndFeelTest.this);
}
}
public static void main(String[] args)
{
new LookAndFeelTest();
}
}
----------------解决方案--------------------------------------------------------
能给个下载地址吗?
----------------解决方案--------------------------------------------------------
这个lookandfeel挺好看的,我挺喜欢的,不家很多
你可以上网自己找
----------------解决方案--------------------------------------------------------
这个我有.呵呵.
----------------解决方案--------------------------------------------------------
那你就用它来改善一下你的界面啊
----------------解决方案--------------------------------------------------------