ZKX's LAB

java编写一个图形界面程序 java--图形界面编程

2020-10-16知识13

怎样用java编写图形界面的Application程序 java编写图形界面需要用到swing等组件,可以在eclipse中安装windowbuilder来开发窗体,自动生成窗体代码,然后自己再根据需要修改,如:package mainFrame;import java.awt.EventQueue;import java.awt.event.MouseAdapter;import java.awt.event.MouseEvent;import javax.swing.ImageIcon;import javax.swing.JButton;import javax.swing.JCheckBox;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JPanel;import javax.swing.JPasswordField;import javax.swing.JTextField;import javax.swing.SwingConstants;import javax.swing.UIManager;import javax.swing.UnsupportedLookAndFeelException;import javax.swing.border.EmptyBorder;public class Mian_login extends JFrame {private JPanel contentPane;private JTextField text_LoginName;private JPasswordField Login_password;Launch the application.public static void main(String[]args){EventQueue.invokeLater(new Runnable(){Overridepublic void run(){try {Mian_login frame=new Mian_login();frame.setVisible(true);} catch(Exception e){e。.

java编写一个图形界面程序 java--图形界面编程

java 图形界面编程问题 package Test1;import java.awt.*;import javax.swing.*;class Jie5 extends JFrame {JPanel contentPane,northPanel,southPanel;JTextField jtf1,jtf2;JButton jb[];public Jie5(){contentPane=new JPanel();northPanel=new JPanel();southPanel=new JPanel();jtf1=new JTextField();jtf2=new JTextField();jb=new JButton[10];this.setContentPane(contentPane);contentPane.setLayout(new BorderLayout(4,4));contentPane.add(northPanel,BorderLayout.NORTH);northPanel.setLayout(new GridLayout(3,3,4,4));for(int i=0;i;i+){jb[i]=new JButton(\"\"+(i+1));northPanel.add(jb[i]);}contentPane.add(southPanel,BorderLayout.SOUTH);southPanel.setLayout(new GridLayout(1,2,4,4));southPanel.add(jtf1);jtf1.setColumns(10);southPanel.add(jtf2);jtf2.setColumns(10);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);this.setBounds(30,30,400,400);this.setTitle(\"hello\");}}public class Demo5 {param argspublic static void main(String[]args){try {TODO Auto-generated method stubUIManagersetLookAndFeel(。

java编写一个图形界面程序 java--图形界面编程

java编程实现图形界面 import java.awt.Container;import java.awt.FlowLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JFrame;import javax.swing.JOptionPane;import javax.swing.JPasswordField;import javax.swing.JTextField;import javax.swing.JButton;public class mi{private static String username;private static String password;private static JTextField[]t={new JTextField(\"账号:\",8),new JTextField(10),new JTextField(\"密码:\",8),new JPasswordField(10)};public static void main(String args[]){JFrame app=new JFrame(\"账号密码演示程序\");app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);app.setSize(280,120);Container c=app.getContentPane();c.setLayout(new FlowLayout());t[0].setEditable(false);t[2].setEditable(false);for(int i=0;i;i+)c.add(t[i]);t[1].setText(\"\");JButton[]b={new JButton(\"确定\"),new JButton(\"重置\")};c.add(b[0]);c.add(b[1]);app.setLocationRelativeTo(null);app.setVisible(true);b[1].addActionListener(new ActionListener(){public void 。

java编写一个图形界面程序 java--图形界面编程

java图形界面编程 FileInputStream等流、JTextArea,读文件,使用java.io做个JFrame

java编程,涉及图形界面 /*我做的一个图片查看器,滚轮和ctrl+↑调整大小。import java.awt.BorderLayout;import java.awt.Dimension;import java.awt.EventQueue;import java.awt.Graphics;import java.awt.Image;import java.awt.Toolkit;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.KeyEvent;import java.awt.event.KeyListener;import java.awt.event.MouseWheelEvent;import java.awt.event.MouseWheelListener;import java.io.File;import javax.swing.JButton;import javax.swing.JComponent;import javax.swing.JFileChooser;import javax.swing.JFrame;import javax.swing.filechooser.FileFilter;public class ScaleImageTest extends JFrame {public ScaleImageTest(){this.setDefaultCloseOperation(EXIT_ON_CLOSE);this.setSize(500,400);open=new JButton(\"OPEN\");open.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){JFileChooser chooser=new JFileChooser(\".\");chooser.setMultiSelectionEnabled(false);chooser.addChoosableFileFilter(new FileFilter(){Overridepublic 。

Java中怎么样进行图形界面编程? 用NetBeans做,可以直接拖放,不用自己布局,但是效率不怎么好

JAVA编程:编写一个图形界面的Application程序 编写一个图形界面的Application程序.包括一个文本框和一个按钮,在文本框中输入若干字符串,然后将其保存在文件中.1。.

java编写一个图形界面程序 import java.awt.*;import java.awt.event.*;import java.util.*;import javax.swing.*;import javax.swing.border.Border;class MainFrame extends JFrame {private static final long serialVersionUID=1L;private Map,Integer>;sizes=new HashMap,Integer>;();private Map,Integer>;styles=new HashMap,Integer>;();private Map,Integer>;toppings=new HashMap,Integer>;();public MainFrame(){sizes.put(\"Extra Large\",10);sizes.put(\"Large\",8);sizes.put(\"Medium\",5);sizes.put(\"Small\",3);styles.put(\"Deep Dish\",20);styles.put(\"Regular\",10);styles.put(\"Thin Crust\",5);styles.put(\"Chicago\",3);toppings.put(\"Cheese\",8);toppings.put(\"Tomato\",7);toppings.put(\"Peppers\",6);toppings.put(\"Peperoni\",5);this.setTitle(\"布局及事件处理\");this.setSize(450,350);this.setLayout(new BorderLayout());this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);JLabel lblTitle=new JLabel();lblTitle.setText(\"Pizzeria Juno\");lblTitle.setFont(new Font(\"宋体\",Font.BOLD,36));lblTitle.setHorizontalAlignment(SwingConstants.CENTER);this.add(\"North\",。

JAVA 图形界面编程问题 在你按钮百添加完之后使用updateUI()方法就可以了。因为你那度些按钮是画在jpanel上的,所知以道要使用那个组件的updateUI方法,即内jpanel.add(new JButton(\"按钮\"+(buttonCount+)));之后添加一句jpanel.updateUI();这样就能容看到效果了。

java里边图形界面编程 add(a1,BorderLayout.EAST);this;东\");JButton a2=new JButton(\".setSize(500修改成这样:import java.awt.*;import javax,400).NORTH);this.setDefaultCloseOperation(JFrame.add(a5,BorderLayout.CENTER);this,BorderLayout;中\");this;public class test2 extends JFrame{public static void main(String[]args){test2 a=new test2();}public test2(){JButton a1=new JButton(\".*;this.add(a4.add(a3,BorderLayout.SOUTH);this.setLocation(800,600);this;北\");JButton a5=new JButton(\"南\");JButton a4=new JButton(\"西\");JButton a3=new JButton(\".setTitle(\"边界布局BorderLayout\");this.EXIT_ON_CLOSE);this.swing.add(a2,BorderLayout.WEST);this

#swing#图形界面

qrcode
访问手机版