?? selectlevelp.java
字號:
package dialog;import java.awt.*;import java.awt.event.*;import javax.swing.*;import TFrame;public class selectLevelP extends JPanel{ TFrame m_tFrame; JDialog m_dialog; Scrollbar scrollbar1 = new Scrollbar(); JLabel label1 = new JLabel(); JButton button1 = new JButton(); GridBagLayout gridBagLayout1 = new GridBagLayout(); public selectLevelP(TFrame tFrame,JDialog d) { m_tFrame=tFrame; m_dialog=d; try { jbInit(); System.out.println(tFrame.m_tetrics.getPlayLevel()); scrollbar1.setValue(tFrame.m_tetrics.getPlayLevel()); label1.setText("你選擇的的等級:"+scrollbar1.getValue()); } catch(Exception e) { e.printStackTrace(); } } private void jbInit() throws Exception { this.setLayout(gridBagLayout1); scrollbar1.setMaximum(15); scrollbar1.setMinimum(1); scrollbar1.setOrientation(0); scrollbar1.setPageIncrement(1); scrollbar1.setValue(5); scrollbar1.setVisibleAmount(1); scrollbar1.addAdjustmentListener(new java.awt.event.AdjustmentListener() { public void adjustmentValueChanged(AdjustmentEvent e) { scrollbar1_adjustmentValueChanged(e); } }); label1.setText("你選擇的的等級:5"); button1.setLabel("確定"); button1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { button1_actionPerformed(e); } }); this.add(scrollbar1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(14, 39, 0, 45), 118, 3)); this.add(button1, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0 ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 84, 10, 85), 22, -3)); this.add(label1, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(9, 50, 0, 62), 35, 8)); } void button1_actionPerformed(ActionEvent e) { m_dialog.dispose(); } void scrollbar1_adjustmentValueChanged(AdjustmentEvent e) { label1.setText("你選擇的的等級:"+scrollbar1.getValue()); int nLevel=scrollbar1.getValue(); m_tFrame.m_tetrics.setPlayLevel(nLevel); if(m_tFrame.m_nNetStatus==TFrame.SERVER)m_tFrame.sendStr("Level:"+nLevel); }}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -