感谢您回答我之前关于java中GUI的问题.我现在想知道专业人士选择什么解决方案来获得一个很好的GUI,用于"真正的"应用程序.你是否使用swing和JComponents并改变"外观和感觉"?你更喜欢awt还是其他图书馆?
对不起,如果这个问题听起来很奇怪,我是学生,我真的不知道java在现实世界中是如何使用的......
我最近一直在讨论Java swing,但它很难看!是否大多数人使用swing或其他东西编写Java GUI?我真的很感激推荐.我不想使用GUI构建器,因为我需要先了解一切是如何工作的.
谢谢!
有没有人知道"皮肤"Java桌面应用程序的方法.(像Winamp皮肤,或MirandaIM的皮肤)?我不想创造自己的外观和感觉.
我扩展了JDialog来创建一个自定义对话框,用户必须填写一些字段: 对话框http://www.freeimagehosting.net/uploads/3d4c15ed9a.jpg
我该如何检索输入的数据?
我提出了一个有效的解决方案.它模仿JOptionPane,但由于涉及静态字段,我这样做对我来说看起来很难看......这大致是我的代码:
public class FObjectDialog extends JDialog implements ActionListener {
private static String name;
private static String text;
private JTextField fName;
private JTextArea fText;
private JButton bAdd;
private JButton bCancel;
private FObjectDialog(Frame parentFrame) {
super(parentFrame,"Add an object",true);
// build the whole dialog
buildNewObjectDialog();
setVisible(true);
}
@Override
public void actionPerformed(ActionEvent ae) {
if(ae.getSource()==bAdd){
name=fName.getText();
text=fText.getText();
}
else {
name=null;
text=null;
}
setVisible(false);
dispose();
}
public static String[] showCreateDialog(Frame parentFrame){
new FObjectDialog(parentFrame);
String[] res={name,text};
if((name==null)||(text==null))
res=null;
return res;
}
} …Run Code Online (Sandbox Code Playgroud)