- 博客(11)
- 收藏
- 关注
原创 网格布局管理器GridLayout
p1=new JPanel();p1.setBackground(Color.ORANGE);//4行,4列,水平3个像素,竖直3个像素p1.setLayout(newGridLayout(4,4,3,3));b0=new JButton("A");p1.add(b0);b1=new JButton("B");p1.add(b1);b2=new JButton(
2013-12-15 15:30:21 689
原创 菜单使用
1) 右键弹出式菜单privateJPopupMenu popMenu=new JPopupMenu();privateJMenuItem pop1,pop2,pop3; //定义监听器PopMenuActionListenerlistener=new PopMenuActionListener();//建菜单项,并添加监听器pop1=new JMenuItem
2013-12-12 00:47:18 647
原创 选项卡JTabbedPane
privateJTabbedPane tp=new JTabbedPane(SwingConstants.BOTTOM);新建一个选项卡,参数为选项卡标签出现的位置,上面表示出现在底部。要改变位置:tp.setTabPlacement(JTabbedPane.TOP);JPanelpaneOne=new JPanel();JPanel paneTwo=new JPanel();
2013-12-10 22:43:29 640
原创 列表框JList和组合列表框JComboBox
首先写数据模型//列表框class ListModelExampleextends AbstractListModel{ String values[]={"张三","李四","王五","周六","赵七","孙八"}; public int getSize() { return values.length; } pu
2013-12-10 22:42:35 931
原创 进度监视器ProgressMonitor
//更新进度条的线程class MyProgressThread extends Thread{ private ProgressMonitormonitor; private boolean stopStatus=false; int min=0; int max=100; //构造函数 public MyPr
2013-12-08 22:32:18 1707
原创 Struts2异常处理机制
1) 配置使用Struts2时,在配置文件中配置异常映射就能拦截特定的异常,转入对应的页面。packagename="exetionLearn"extends="struts-default"namespace="/exception"> global-results> resultname="showException">/WEB-INF/pag
2013-12-06 21:51:23 544
原创 BorderLayout 边界布局管理器
this.setLayout(new BorderLayout());this.add(new JButton("page start"), BorderLayout.PAGE_START);this.add(new JButton("page end"), BorderLayout.PAGE_END);this.add(new JButton("center"), BorderLay
2013-12-06 20:34:17 1081
原创 卡片布局管理器
使用此布局时,首先建一个卡片布局管理器CardLayout cardlayout=new CardLayout();再建一个final JPanel displayPane=new JPanel();,设置它和布局displayPane.setLayout(cardlayout);卡片布局相当于有一张张的卡片,每次显示一张。通常建一个JPanel表示这些卡片//第一个panel
2013-12-06 00:15:01 794
原创 java 图片JLabel
protected staticImageIcon createImageIcon(String path, String description) { //调用这个类的getResource(),这样相对路径,基于这个类所在位置 java.net.URL imgURL = RadioButtonDemo.class.getResou
2013-12-04 21:22:23 616
原创 struts2国际化
一、 全局范围1) 首先写好资源文件globalMessage_en_US.properties:welcome=welcome to gather shellsiteglobalMessage_zh_CN.properties:welcome=\u6b22\u8fce\u6765\u5230\u0067\u0061\u0074\u0068\u0065\u0072
2013-12-02 22:28:55 590
原创 java swing边框Border的使用
有多种不同形式的边框Borderblackline,etched,raisedbevel,loweredbevel,empty;//黑色线边框blackline=BorderFactory.createLineBorder(Color.BLACK);//创建蚀刻边框etched= BorderFactory.createEtchedBorder();//创建凸出边框ra
2013-12-01 20:09:35 1825
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人