解决方案 »
- struts2可以只处理不跳转吗?
- 关于Spring事务管理的疑问,欢迎讨论,帮顶
- mvnforum配置问题
- 导入他人的ssh项目,使用hibernate.hbm2ddl.auto属性为update,不自动创建表结构
- 一般论坛上,发表一个帖子后,会提示"3秒之后自动跳转";这个功能是怎样实现的啊?
- 如何将后台生成页面数据(包括格式,图片)导出到WORD中,有没有什么工具?
- radio中的value的取值如何能是一个对象?
- spring 问题:
- 菜鸟100分请教:怎样才能对j2ee的软件开发架构有一个总体的认识?(不够再加)
- 关于Java 线程池的调用
- FCKeditor插件问题!
- 什么是数据字典,我查了例子,还是有点蒙,请帮忙予以解说。谢谢。
请XDJM们,速度告诉我一下。
谢谢了
public static void main(String [] args){
JFrame frame = new JFrame();
frame.setTitle("加密");
frame.setBounds(300, 300, 600, 400);
// JLabel encryptType = new JLabel("加密類型");
// encryptType.setSize(50, 100);
JRadioButton encrypt_AES128 = new JRadioButton();
encrypt_AES128.setText("加密類型");
encrypt_AES128.setSize(50,200);
// frame.add(encryptType);
frame.add(encrypt_AES128);
frame.setVisible(true);
frame.setResizable(false);
}
JFrame frame = new JFrame();
frame.setTitle("加密");
frame.setBounds(300, 300, 600, 400); Container con = frame.getContentPane();//获取frame的内容面板
con.setLayout(new FlowLayout());//把内容面板设置为流式布局(其他的布局也行) JLabel encryptType = new JLabel("加密类型");
encryptType.setFont(new Font("宋体",5,20));
encryptType.setSize(50, 100);
JRadioButton encrypt_AES128 = new JRadioButton();
encrypt_AES128.setSize(50,200); con.add(encryptType);//把JLabel 组件添加到内容面板
con.add(encrypt_AES128);//把JRadioButton 组件添加到内容面板 frame.setVisible(true);
frame.setResizable(false);这样就可以了!!
你所说的“为什么我设置它的位置,不移动?”我看不懂事什么意思,如果你是想把窗口显示出来的时候直接在屏幕中间的话,就把 frame.setBounds(300, 300, 600, 400)换成frame.setSize(600, 600)来设置大小,在 frame.setVisible(true)的前面加上frame.setLocationRelativeTo(null)来定位窗口显示在屏幕的中间。
import java.awt.FlowLayout;
import java.awt.Font;import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextArea;
import javax.swing.JTextField;public class ViewDisplay extends JFrame{
private JPanel panel;
private JFrame frame;
private JLabel encryptType,encryptKey,encrypt,undo;
private JRadioButton encrypt_AES128;
private JRadioButton encrypt_Base64;
private JTextField encrypt_Key;
private JTextArea encrypt_area1;
private JTextArea encrypt_area2;
private JButton button_encryot;
private JButton button_undo;
//提供一个构造器,以提升视图的初始化
public ViewDisplay(){
frame = new JFrame();
panel = new JPanel();
frame.setTitle("加密");
frame.setBounds(300, 300, 600, 400);
frame.add(panel);
panel.setLayout(new FlowLayout());
encryptType = new JLabel("加密类型:");
encryptType.setFont(new Font("宋体",5,20));
encryptType.setSize(50, 200);//这里的位置移动不了啊
encrypt_AES128 = new JRadioButton();
encrypt_AES128.setText("AES128");
encrypt_AES128.setSize(50, 200);//这里的位置移动不了啊
panel.add(encryptType);
panel.add(encrypt_AES128);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
frame.setResizable(false);
}
}
我上面标注的2个地方不是移动他在窗口中的位置吗?
我怎么设置它的位置,他都是显示在最上面的中间。。为什么?