/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package traceplayer.gui.dialog;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.event.ItemEvent;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
/**
*
* @author kouyunfei
*/
public class ChartsSetting extends JFrame{
boolean preferenceAvalible = false;
public JLabel ampfactorx;
public JLabel ampfactory;
public JLabel maxrangex;
public JLabel maxrangey;
public JButton confirmbtn;
public JButton cancelbtn;
public JTextField ampfactorxText;
public JTextField ampfactoryText;
public JTextField maxrangexText;
public JTextField maxrangeyText;
public JCheckBox displaypoint;
JTabbedPane rootTabbedPane;
JPanel leftlayout;
JPanel rightlayout;
JPanel leftcontentlayout;
JPanel rightcontentlayout;
JPanel contentlayout;
JPanel majorlayout;
JPanel bottomlayout;
public ChartsSetting()
{
initComponents();
}
private void initComponents()
{
int x,y,width,height;
BorderLayout layout = new BorderLayout();//边界布局
layout.setHgap(10);//设置组件之间的垂直间隔
layout.setVgap(10);//设置组件之间的水平间隔
leftlayout = new JPanel();//
rightlayout = new JPanel();
majorlayout = new JPanel();
contentlayout = new JPanel();
bottomlayout = new JPanel();
leftcontentlayout = new JPanel();
rightcontentlayout = new JPanel();
rootTabbedPane = new JTabbedPane();
ampfactorx = new JLabel("x轴放大系数:");
ampfactory = new JLabel("y轴放大系数:");
maxrangex = new JLabel("x轴最大范围:");
maxrangey = new JLabel("y轴最大范围:");
confirmbtn = new JButton("确定:");
cancelbtn = new JButton("取消:");
displaypoint = new JCheckBox("显示数据点");
ampfactorxText = new JTextField();
ampfactoryText = new JTextField();
maxrangexText = new JTextField();
maxrangeyText = new JTextField();
ampfactorx.setBounds(30,30,100,30);
ampfactorxText.setBounds(110,32,80,25);
ampfactory.setBounds(230,30,100,30);
ampfactoryText.setBounds(310,32,80,25);
maxrangex.setBounds(30,80,100,30);
maxrangexText.setBounds(110,82,80,25);
maxrangey.setBounds(230,80,100,30);
maxrangeyText.setBounds(310,82,80,25);
displaypoint.setBounds(30,130,100,30);
contentlayout.add(ampfactorx);//添加组件
contentlayout.add(ampfactory);
contentlayout.add(ampfactorxText);
contentlayout.add(ampfactoryText);
contentlayout.add(maxrangex);
contentlayout.add(maxrangexText);
contentlayout.add(maxrangey);
contentlayout.add(maxrangeyText);
contentlayout.add(displaypoint);
rootTabbedPane.add("基本设置",contentlayout);
majorlayout.setLayout(layout);
leftlayout.setLayout(new BoxLayout(leftlayout, BoxLayout.Y_AXIS));//组件垂直排列或者水平排列 通过BoxLayout.Y_AXIS进行设置
rightlayout.setLayout(new BoxLayout(rightlayout, BoxLayout.Y_AXIS));
leftcontentlayout.setLayout(null);
rightcontentlayout.setLayout(null);
contentlayout.setLayout(null);
displaypoint.addItemListener(new java.awt.event.ItemListener() {//复选框事件
public void itemStateChanged(ItemEvent e) {
System.out.println("fsdfsdsf");
}
});
bottomlayout.setLayout(new BoxLayout(bottomlayout,BoxLayout.X_AXIS));
bottomlayout.add(Box.createRigidArea(new Dimension(100,40)));
bottomlayout.add(confirmbtn);
bottomlayout.add(Box.createVerticalStrut(6));//设置间距Strut 只能设置一个方向的间距
bottomlayout.add(cancelbtn);
bottomlayout.add(Box.createRigidArea(new Dimension(100,40)));//设置间距 Rigid 可以设置水平和垂直方向的间距
majorlayout.add(bottomlayout,BorderLayout.SOUTH);//
majorlayout.add(rootTabbedPane, BorderLayout.CENTER);
majorlayout.setSize(800, 600);
majorlayout.setBorder(BorderFactory.createEmptyBorder(2, 2, 5, 2));//使边界留出一定的空间
JPanel panel = new JPanel();
panel.setSize(600,300);
/*
panel.setLayout(layout);
panel.add(new JButton("Center"),BorderLayout.CENTER);
panel.add(new JButton("Line Start"),BorderLayout.LINE_START);
panel.add(new JButton("Line End"),BorderLayout.LINE_END);
panel.add(new JButton("East"),BorderLayout.EAST);
panel.add(new JButton("West"),BorderLayout.WEST); 0
panel.add(new JButton("North"),BorderLayout.NORTH); */
panel.add(new JButton("South"),BorderLayout.SOUTH);
this.setContentPane(majorlayout);
java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
setBounds((screenSize.width - 550) / 2, (screenSize.height - 400) / 2-100, 1000, 600);//居中显示并设置大小
this.setSize(480,400);
this.setResizable(false);//不可窗口改变大小
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//退出时自动关闭进程
this.setTitle("设置");
}
public static void main(String[] args) {
ChartsSetting fram = new ChartsSetting();
fram.setVisible(true);
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package traceplayer.gui.dialog;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.event.ItemEvent;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
/**
*
* @author kouyunfei
*/
public class ChartsSetting extends JFrame{
boolean preferenceAvalible = false;
public JLabel ampfactorx;
public JLabel ampfactory;
public JLabel maxrangex;
public JLabel maxrangey;
public JButton confirmbtn;
public JButton cancelbtn;
public JTextField ampfactorxText;
public JTextField ampfactoryText;
public JTextField maxrangexText;
public JTextField maxrangeyText;
public JCheckBox displaypoint;
JTabbedPane rootTabbedPane;
JPanel leftlayout;
JPanel rightlayout;
JPanel leftcontentlayout;
JPanel rightcontentlayout;
JPanel contentlayout;
JPanel majorlayout;
JPanel bottomlayout;
public ChartsSetting()
{
initComponents();
}
private void initComponents()
{
int x,y,width,height;
BorderLayout layout = new BorderLayout();//边界布局
layout.setHgap(10);//设置组件之间的垂直间隔
layout.setVgap(10);//设置组件之间的水平间隔
leftlayout = new JPanel();//
rightlayout = new JPanel();
majorlayout = new JPanel();
contentlayout = new JPanel();
bottomlayout = new JPanel();
leftcontentlayout = new JPanel();
rightcontentlayout = new JPanel();
rootTabbedPane = new JTabbedPane();
ampfactorx = new JLabel("x轴放大系数:");
ampfactory = new JLabel("y轴放大系数:");
maxrangex = new JLabel("x轴最大范围:");
maxrangey = new JLabel("y轴最大范围:");
confirmbtn = new JButton("确定:");
cancelbtn = new JButton("取消:");
displaypoint = new JCheckBox("显示数据点");
ampfactorxText = new JTextField();
ampfactoryText = new JTextField();
maxrangexText = new JTextField();
maxrangeyText = new JTextField();
ampfactorx.setBounds(30,30,100,30);
ampfactorxText.setBounds(110,32,80,25);
ampfactory.setBounds(230,30,100,30);
ampfactoryText.setBounds(310,32,80,25);
maxrangex.setBounds(30,80,100,30);
maxrangexText.setBounds(110,82,80,25);
maxrangey.setBounds(230,80,100,30);
maxrangeyText.setBounds(310,82,80,25);
displaypoint.setBounds(30,130,100,30);
contentlayout.add(ampfactorx);//添加组件
contentlayout.add(ampfactory);
contentlayout.add(ampfactorxText);
contentlayout.add(ampfactoryText);
contentlayout.add(maxrangex);
contentlayout.add(maxrangexText);
contentlayout.add(maxrangey);
contentlayout.add(maxrangeyText);
contentlayout.add(displaypoint);
rootTabbedPane.add("基本设置",contentlayout);
majorlayout.setLayout(layout);
leftlayout.setLayout(new BoxLayout(leftlayout, BoxLayout.Y_AXIS));//组件垂直排列或者水平排列 通过BoxLayout.Y_AXIS进行设置
rightlayout.setLayout(new BoxLayout(rightlayout, BoxLayout.Y_AXIS));
leftcontentlayout.setLayout(null);
rightcontentlayout.setLayout(null);
contentlayout.setLayout(null);
displaypoint.addItemListener(new java.awt.event.ItemListener() {//复选框事件
public void itemStateChanged(ItemEvent e) {
System.out.println("fsdfsdsf");
}
});
bottomlayout.setLayout(new BoxLayout(bottomlayout,BoxLayout.X_AXIS));
bottomlayout.add(Box.createRigidArea(new Dimension(100,40)));
bottomlayout.add(confirmbtn);
bottomlayout.add(Box.createVerticalStrut(6));//设置间距Strut 只能设置一个方向的间距
bottomlayout.add(cancelbtn);
bottomlayout.add(Box.createRigidArea(new Dimension(100,40)));//设置间距 Rigid 可以设置水平和垂直方向的间距
majorlayout.add(bottomlayout,BorderLayout.SOUTH);//
majorlayout.add(rootTabbedPane, BorderLayout.CENTER);
majorlayout.setSize(800, 600);
majorlayout.setBorder(BorderFactory.createEmptyBorder(2, 2, 5, 2));//使边界留出一定的空间
JPanel panel = new JPanel();
panel.setSize(600,300);
/*
panel.setLayout(layout);
panel.add(new JButton("Center"),BorderLayout.CENTER);
panel.add(new JButton("Line Start"),BorderLayout.LINE_START);
panel.add(new JButton("Line End"),BorderLayout.LINE_END);
panel.add(new JButton("East"),BorderLayout.EAST);
panel.add(new JButton("West"),BorderLayout.WEST); 0
panel.add(new JButton("North"),BorderLayout.NORTH); */
panel.add(new JButton("South"),BorderLayout.SOUTH);
this.setContentPane(majorlayout);
java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
setBounds((screenSize.width - 550) / 2, (screenSize.height - 400) / 2-100, 1000, 600);//居中显示并设置大小
this.setSize(480,400);
this.setResizable(false);//不可窗口改变大小
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//退出时自动关闭进程
this.setTitle("设置");
}
public static void main(String[] args) {
ChartsSetting fram = new ChartsSetting();
fram.setVisible(true);
}
]