当前位置:我的异常网» J2SE » 关于JLabel的setText在监听器中不刷新有关问题
关于JLabel的setText在监听器中不刷新有关问题(2)
www.myexceptions.net 网友分享于:2013-12-17 浏览:253次
jpPosition.setBorder(new TitledBorder("Position"));
// Place title justification radio buttons
JPanel jpJustification = new JPanel();
jpJustification.setLayout(new GridLayout(3,1));
jpJustification.add(jrbLeft = new JRadioButton("LEFT"));
jpJustification.add(jrbCenter = new JRadioButton("CENTER"));
jpJustification.add(jrbRight = new JRadioButton("RIGHT"));
jpJustification.setBorder(new TitledBorder("Justification"));
// Creat panel jpTitleOptions to how jpPosition and jpJustification
JPanel jpTitleOptions = new JPanel();
jpTitleOptions.setLayout(new BorderLayout());
jpTitleOptions.add(jpPosition,BorderLayout.CENTER);
jpTitleOptions.add(jpJustification,BorderLayout.EAST);
// Create Panel jpTitle to hold a check box and title position radio
// buttons, and title justification radio buttons
JPanel jpTitle = new JPanel();
jpTitle.setBorder(new TitledBorder("Border Title"));
jpTitle.setLayout(new BorderLayout());
jpTitle.add(jchkTitled = new JCheckBox("Titled"),BorderLayout.NORTH);
jpTitle.add(jpTitleOptions , BorderLayout.CENTER);
// Group radio buttons for title position
ButtonGroup btgTitlePosition = new ButtonGroup();
btgTitlePosition.add(jrbAboveBottom);
btgTitlePosition.add(jrbAboveTop);
btgTitlePosition.add(jrbBottom);
btgTitlePosition.add(jrbTop);
btgTitlePosition.add(jrbBelowBottom);
btgTitlePosition.add(jrbBelowTop);
// Group radio buttons for title justification
ButtonGroup btgTitleJustification = new ButtonGroup();
btgTitleJustification.add(jrbLeft);
btgTitleJustification.add(jrbCenter);
btgTitleJustification.add(jrbRight);
//22222222222222222222222222222
// Create Panel jpBorderStyle to hold border style radio buttons
JPanel jpBorderStyle = new JPanel();
jpBorderStyle.setBorder(new TitledBorder("Border Style"));
jpBorderStyle.setLayout(new GridLayout(6,1));
jpBorderStyle.add(jrbLoweredBevel = new JRadioButton("Lowered Bevel"));
jpBorderStyle.add(jrbRaisedBevel = new JRadioButton("Raised Bevel"));
jpBorderStyle.add(jrbEtched = new JRadioButton("Etched"));
jpBorderStyle.add(jrbLine = new JRadioButton("Line"));
jpBorderStyle.add(jrbMatte = new JRadioButton("Matte"));
jpBorderStyle.add(jrbEmpty = new JRadioButton("Empty"));
//Group radio buttons for border styles
ButtonGroup btgBorderStyle = new ButtonGroup();
btgBorderStyle.add(jrbLoweredBevel);
btgBorderStyle.add(jrbRaisedBevel);
btgBorderStyle.add(jrbEtched);
btgBorderStyle.add(jrbLine);
btgBorderStyle.add(jrbMatte);
btgBorderStyle.add(jrbEmpty);
// Create Panel jpAllChoices to place jpTitle and jpBorderStyle
JPanel jpAllChoies = new JPanel();
jpAllChoies.setLayout(new BorderLayout());
jpAllChoies.add(jpTitle , "Center");
jpAllChoies.add(jpBorderStyle, "East");
// Place panels in the frame
setLayout(new BorderLayout());
add(jLabel1,"Center");
add(jpAllChoies,"South");
文章评论