TabPage_today3_C/C++_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > C/C++ > TabPage_today3

TabPage_today3

 2010/12/23 8:03:25  cesul  http://cesul.javaeye.com  我要评论(0)
  • 摘要:{//对OutlayPanel和IncomePanel分别定义incomePanel.setLayout(gridbag);GridBagConstraintscc=newGridBagConstraints();cc.gridx=0;cc.gridy=0;//c.gridwidth=GridBagConstraints.RELATIVE;//c.gridheight=GridBagConstraints.RELATIVE;cc.fill=GridBagConstraints.BOTH;cc
  • 标签:
			{  //对OutlayPanel和IncomePanel分别定义
				incomePanel.setLayout(gridbag);
				GridBagConstraints cc = new GridBagConstraints();
				cc.gridx = 0 ;
				cc.gridy = 0;
				
//				c.gridwidth = GridBagConstraints.RELATIVE; 
//				c.gridheight = GridBagConstraints.RELATIVE; 
				cc.fill = GridBagConstraints.BOTH;
				cc.weightx = 1.0;
				cc.weighty = 1.0;
				JLabel label1 = new JLabel("金额 (元):");
				label1.setFont(font);
				incomePanel.add(label1, cc);
				
				//****
				cc.gridx = 0 ;
				cc.gridy = 1;
				JLabel label2 = new JLabel("收入分类:");
				label2.setFont(font);
				incomePanel.add(label2, cc);
				
				//****
				cc.gridx = 0 ;
				cc.gridy = 2;
				JLabel label3 = new JLabel("时间(选择):");
				label3.setFont(font);
				incomePanel.add(label3, cc);
				
				
				//*****
				cc.gridx = 1 ;
				cc.gridy = 0;
				text3.setFont(inputFont);
				incomePanel.add(text3, cc);

				//****
				cc.gridx = 1 ;
				cc.gridy = 1;
				Object labels[] = {"薪资薪酬", "利润奖励", "意外惊喜"};  //today面板上的下拉选择框
				comboBox2 = new JComboBox(labels);
				comboBox2.setFont(inputFont);
				comboBox2.setBackground(new Color(0, 128, 255));  //下拉选择框的颜色
				
				incomePanel.add(comboBox2, cc);
				
				//**** 
				cc.gridx = 1;    //时间
				cc.gridy = 2;
				text4.setPreferredSize(new Dimension(100, 10));   //选择时间的输入框,暂时不支持DatePicker
				text4.setFont(inputFont);
				text4.setText(CalendarUtils.rightnow());
				incomePanel.add(text4, cc);
				
				//*********
				cc.gridx = 2;
				cc.gridy = 0;
				cc.gridheight = 3;
				
				incomePanel.add(scrollPane2, cc);
				
				//*****
				cc.gridx = 3;
				cc.gridy = 0;
				cc.gridheight = 3;
				JButton jb = new JButton("保存收入");
				jb.setCursor(btcurson);
				jb.setFont(btnFont);
				jb.setPreferredSize(new Dimension(40, 30));
				
				jb.addActionListener(new ActionListener() {
					@Override
					public void actionPerformed(ActionEvent e) {
						//TabButtonAction.save_content(param1, param2);
						if (isNeeded(text3.getText())) {
							System.out.println(text4.getText() + " | " + text3.getText() + "   " + jt.getText() + "   " + (String)comboBox2.getSelectedItem());
						} else
							JOptionPane.showMessageDialog(null, "请确认您的输入,金额不能识别", "来自系统的提示:", JOptionPane.WARNING_MESSAGE);
						
					}
				});
				incomePanel.add(jb, cc);
				
			}
		}
	}
	
	////输入验证类
	public Boolean isNeeded(String input){
		return input.matches("^[1-9][0-9]*?.??[0-9]??[0-9]??");  //规范
	}
	
	public static void updateContent(String str) { 
//		ja.setText(ja.getText() + "\r\n" + str);
	}
	public static void clearContent() { 
//		ja.setText("");
	}
	public JPanel getCenterPane() {
		return centerPane;
	}
	public MyToolBar getToolBar() {
		return toolbar;
	}
}
上一篇: const 下一篇: scons随笔
  • 相关文章
发表评论
用户名: 匿名