tvchmod.java

来自「JavaTV Program source code Need to pl」· Java 代码 · 共 223 行

JAVA
223
字号
/* * 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.*;import java.awt.*;public class TvChMod extends javax.swing.JFrame {    /*    *	Add channel to list    */        public TvChMod() {            initComponents();            }			    	public void initComponents() {	    JFrame ModChFrame = new JFrame();	    JPanel jPanelId = new JPanel();	    JPanel jPanelName = new JPanel();	    	    JPanel jPanelFreq = new JPanel();	    	    	    JPanel jPanelDesc = new JPanel();	    	    	    JPanel jPanelBottom = new JPanel();	    	    	    	    JPanel jPanelTop = new JPanel();	    	    	    	    	    JLabel jLabelMod1 = new JLabel();	    JLabel jLabelMod2 = new JLabel();	    JLabel jLabelMod3 = new JLabel();	    JLabel jLabelMod4 = new JLabel();	    	    	    JTextField jTextFieldChId = new JTextField();	    JTextField jTextFieldChName = new JTextField();	    	    JTextField jTextFieldChFreq = new JTextField();	    	    JTextField jTextFieldChDesc = new JTextField();	    	    JButton jButtonUp = new JButton();	    	    JButton jButtonDown = new JButton();	    JButton jButtonTry = new JButton();	    	    	    JButton jButtonMod = new JButton();	    	    	    JButton jButtonModCancel = new JButton();	    	    	    //	    setAlwaysOnTop(true);	    SpringLayout layout = new javax.swing.SpringLayout();	    	    //	    jPanelMod1.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));	    jPanelBottom.setLayout(layout);	    jPanelId.setLayout(new FlowLayout(java.awt.FlowLayout.LEFT));	    jPanelName.setLayout(new FlowLayout(java.awt.FlowLayout.LEFT));	    jPanelFreq.setLayout(new FlowLayout(java.awt.FlowLayout.LEFT));	    jPanelDesc.setLayout(new FlowLayout(java.awt.FlowLayout.LEFT));    	    jPanelTop.setLayout(new javax.swing.BoxLayout(jPanelTop, BoxLayout.Y_AXIS));//            getContentPane().setLayout(new javax.swing.BoxLayout(getContentPane(), BoxLayout.Y_AXIS));            getContentPane().setLayout(new BorderLayout());	    	    setTitle("Mod new channel to list...");	            setBounds(50, 50, 400, 300);	    jButtonUp.setIcon(new javax.swing.ImageIcon("images/1uparrow.png"));	    jButtonDown.setIcon(new javax.swing.ImageIcon("images/1downarrow.png"));	    	    jButtonTry.setText("Try...");	    	    	    jLabelMod1.setText("Channel Id: ");	    jLabelMod1.setPreferredSize(new java.awt.Dimension(150,20));	    	    jLabelMod2.setText("Channel Name: ");	    jLabelMod2.setPreferredSize(new java.awt.Dimension(150,20));	    	    	    jLabelMod3.setText("Channel Frequency: ");	    jLabelMod3.setPreferredSize(new java.awt.Dimension(150,20));	    	    	    jLabelMod4.setText("Description: ");	    	    jLabelMod4.setPreferredSize(new java.awt.Dimension(150,20));	    	                jPanelTop.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));	    jPanelBottom.setPreferredSize(new java.awt.Dimension(300,40));	    	    	    jTextFieldChId.setPreferredSize(new java.awt.Dimension(60,20));	    jTextFieldChName.setPreferredSize(new java.awt.Dimension(250,20));	    jTextFieldChFreq.setPreferredSize(new java.awt.Dimension(60,20));	    jTextFieldChDesc.setPreferredSize(new java.awt.Dimension(250,20));            jButtonModCancel.setText("Cancel");	    layout.putConstraint(SpringLayout.EAST, jButtonModCancel,                                 -20,                              SpringLayout.EAST, jPanelBottom);            layout.putConstraint(SpringLayout.NORTH, jButtonModCancel,                                   10,                              SpringLayout.NORTH, jPanelBottom);            jButtonModCancel.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                    jButtonModCancelActionPerformed(evt);		    }	        });	    jButtonMod.setText("Modify...");    	    layout.putConstraint(SpringLayout.EAST, jButtonMod,                             -120,                          SpringLayout.EAST, jPanelBottom);            layout.putConstraint(SpringLayout.NORTH, jButtonMod,                               10,		            SpringLayout.NORTH, jPanelBottom);            jButtonMod.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {	                jButtonModActionPerformed(evt);	            }	        });	    jButtonUp.addActionListener(new java.awt.event.ActionListener() {        	public void actionPerformed(java.awt.event.ActionEvent evt) {	                jButtonUpActionPerformed(evt);	            }	        });            jButtonDown.addActionListener(new java.awt.event.ActionListener() {        	public void actionPerformed(java.awt.event.ActionEvent evt) {	                jButtonDownActionPerformed(evt);	            }	        });		        	jButtonTry.addActionListener(new java.awt.event.ActionListener() {        	public void actionPerformed(java.awt.event.ActionEvent evt) {	                jButtonTryActionPerformed(evt);	            }	        });	    jPanelId.add(jLabelMod1);	    jPanelId.add(jTextFieldChId);	    jPanelName.add(jLabelMod2);	    	    jPanelName.add(jTextFieldChName);	    jPanelFreq.add(jLabelMod3);	    	    jPanelFreq.add(jTextFieldChFreq);	    jPanelFreq.add(jButtonUp);	    jPanelFreq.add(jButtonDown);	    jPanelFreq.add(jButtonTry);	    jPanelDesc.add(jLabelMod4);	    jPanelDesc.add(jTextFieldChDesc);	    jPanelTop.add(jPanelId);	    jPanelTop.add(jPanelName);	    	    jPanelTop.add(jPanelFreq);	    jPanelTop.add(jPanelDesc);	    jPanelBottom.add(jButtonMod);	    	    jPanelBottom.add(jButtonModCancel);	    getContentPane().add(jPanelTop, BorderLayout.PAGE_START);	    getContentPane().add(jPanelBottom, BorderLayout.PAGE_END);	    pack();						}													        private void jButtonModCancelActionPerformed(java.awt.event.ActionEvent evt) {	           System.out.println("Don't saved modifications");		    dispose();	    }        private void jButtonModActionPerformed(java.awt.event.ActionEvent evt) {	           System.out.println("Mod new channel");		    dispose();	    }        private void jButtonUpActionPerformed(java.awt.event.ActionEvent evt) {	           System.out.println(" freq = current freq + 0.250");	    }        private void jButtonDownActionPerformed(java.awt.event.ActionEvent evt) {	           System.out.println(" freq = current freq - 0.250");	    }        private void jButtonTryActionPerformed(java.awt.event.ActionEvent evt) {	           System.out.println(" freq = current freq + 0.250");	    }					      private    	JFrame ModChFrame;    private	JPanel jPanelTop;    private	JPanel jPanelBottom;    private	JPanel jPanelId;        private	JPanel jPanelName;            private	JPanel jPanelFreq;        private	JPanel jPanelDesc;        private	JLabel jLabelMod1;    private	JLabel jLabelMod2;    private	JLabel jLabelMod3;    private	JLabel jLabelMod4;	        private	JTextField jTextFieldChId;    private	JTextField jTextFieldChName;    private	JTextField jTextFieldChFreq;    private	JTextField jTextFieldChDesc;	        private	JButton jButtonUp;        private	JButton jButtonDown;            private	JButton jButtonTry;                    private	JButton jButtonMod;    private	JButton jButtonModCancel;         }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?