📄 tvchadd.java
字号:
/* * Copyright (C) 2005 by Enrico Chiaretti - enrico.chiaretti@gmail.comThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *//* * TvControl.java * * Created on 2 giugno 2005, 12.41 * *//** this is the mainframe user form for the application. * @author enrico chiaretti */import javax.swing.*;public class TvChAdd extends javax.swing.JFrame { /* * Add channel to list */ public TvChAdd() { initComponents(); } public void initComponents() { JFrame AddChFrame = new JFrame(); JPanel jPanelAdd1 = new JPanel(); JPanel jPanelAdd2 = new JPanel(); JLabel jLabelAdd1 = new JLabel(); JLabel jLabelAdd2 = new JLabel(); JLabel jLabelAdd3 = new JLabel(); JLabel jLabelAdd4 = new JLabel(); JTextField jTextFieldChId = new JTextField(); JTextField jTextFieldChName = new JTextField(); JTextField jTextFieldChFreq = new JTextField(); JTextField jTextFieldChDesc = new JTextField(); JButton jButtonAdd = new JButton(); JButton jButtonAddCancel = new JButton(); // setAlwaysOnTop(true); SpringLayout layout = new javax.swing.SpringLayout(); jPanelAdd1.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); jPanelAdd1.setLayout(new java.awt.GridLayout(0, 2)); jPanelAdd2.setLayout(layout); getContentPane().setLayout(new javax.swing.BoxLayout(getContentPane(), BoxLayout.Y_AXIS)); setTitle("Add new channel to list..."); setBounds(50, 50, 400, 300); jLabelAdd1.setText("Channel Id: "); jLabelAdd1.setPreferredSize(new java.awt.Dimension(150,20)); jLabelAdd2.setText("Channel Name: "); jLabelAdd2.setPreferredSize(new java.awt.Dimension(150,20)); jLabelAdd3.setText("Channel Frequency: "); jLabelAdd3.setPreferredSize(new java.awt.Dimension(150,20)); jLabelAdd4.setText("Description: "); jLabelAdd4.setPreferredSize(new java.awt.Dimension(150,20)); jPanelAdd1.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); jPanelAdd2.setPreferredSize(new java.awt.Dimension(300,40)); jButtonAddCancel.setText("Cancel"); layout.putConstraint(SpringLayout.EAST, jButtonAddCancel, -20, SpringLayout.EAST, jPanelAdd2); layout.putConstraint(SpringLayout.NORTH, jButtonAddCancel, 10, SpringLayout.NORTH, jPanelAdd2); jButtonAddCancel.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonAddCancelActionPerformed(evt); } }); jButtonAdd.setText("Add..."); layout.putConstraint(SpringLayout.EAST, jButtonAdd, -120, SpringLayout.EAST, jPanelAdd2); layout.putConstraint(SpringLayout.NORTH, jButtonAdd, 10, SpringLayout.NORTH, jPanelAdd2); jButtonAdd.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonAddActionPerformed(evt); } }); jPanelAdd1.add(jLabelAdd1); jPanelAdd1.add(jTextFieldChId); jPanelAdd1.add(jLabelAdd2); jPanelAdd1.add(jTextFieldChName); jPanelAdd1.add(jLabelAdd3); jPanelAdd1.add(jTextFieldChFreq); jPanelAdd1.add(jLabelAdd4); jPanelAdd1.add(jTextFieldChDesc); jPanelAdd2.add(jButtonAdd); jPanelAdd2.add(jButtonAddCancel); getContentPane().add(jPanelAdd1); getContentPane().add(jPanelAdd2); pack(); } private void jButtonAddCancelActionPerformed(java.awt.event.ActionEvent evt) { System.out.println("Don't add new channel"); dispose(); } private void jButtonAddActionPerformed(java.awt.event.ActionEvent evt) { System.out.println("Add new channel"); //add to list dispose(); } private JFrame AddChFrame; private JPanel jPanelAdd1; private JPanel jPanelAdd2; private JLabel jLabelAdd1; private JLabel jLabelAdd2; private JLabel jLabelAdd3; private JLabel jLabelAdd4; private JTextField jTextFieldChId; private JTextField jTextFieldChName; private JTextField jTextFieldChFreq; private JTextField jTextFieldChDesc; private JButton jButtonAdd; private JButton jButtonAddCancel; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -