
Swing开发GUI笔记
Swing开发GUI笔记
ThinkPet
青年码农一枚
展开
-
JFrame窗体练习1
package com;import javax.swing.JFrame;public class Framefirst extends JFrame{ public Framefirst() { this.setTitle(" hjgj");//设置窗体标题 this.setBounds(300,200,500,500);//设置x轴定位,y轴定位,窗体宽,...原创 2018-02-16 19:48:55 · 525 阅读 · 0 评论 -
背景为渐变色的窗体
主类代码如下package jpanel;import java.awt.EventQueue;import javax.swing.JFrame;public class ColorPanel { private JFrame frame; /** * Launch the application. */ public static void main(String...原创 2018-03-03 17:20:02 · 832 阅读 · 0 评论 -
自动换行的文本域
package editor;import java.awt.Container;import javax.swing.JFrame;import javax.swing.JScrollPane;import javax.swing.JTextArea;public class NewEdit extends JFrame{ public NewEdit() { setBou...原创 2018-03-03 16:46:07 · 1925 阅读 · 0 评论 -
带滚动条的文本编辑器
package editor;import java.awt.Container;import javax.swing.JFrame;import javax.swing.JScrollPane;import javax.swing.JTextArea;public class Editor extends JFrame{ public Editor() { setBound...原创 2018-03-03 16:35:46 · 755 阅读 · 0 评论 -
JPanel面板
package jpanel;import java.awt.BorderLayout;import java.awt.Container;import java.awt.GridLayout;import javax.swing.BorderFactory;import javax.swing.JButton;import javax.swing.JFrame;import j...原创 2018-03-03 15:38:18 · 437 阅读 · 0 评论 -
GridLayout网格布局管理器
package gridLayout;import java.awt.Container;import java.awt.GridLayout;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.WindowConstants;public class GridLayoutPosition...原创 2018-03-03 14:44:51 · 551 阅读 · 0 评论 -
BorderLayout边界布局管理器
package borderLayout;import java.awt.BorderLayout;import java.awt.Container;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.WindowConstants;public class BorderLayoutPo...原创 2018-03-03 14:25:56 · 828 阅读 · 0 评论 -
FlowLayout流布局管理器
package flowLayout;import java.awt.Container;import java.awt.FlowLayout;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.WindowConstants;public class FlowLayoutPosition...原创 2018-03-03 14:04:34 · 356 阅读 · 0 评论 -
单击按钮弹出对话框窗体
package Dialog;import java.awt.Color;import java.awt.Container;import java.awt.Window;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JButton;import ...原创 2018-03-03 13:47:28 · 4003 阅读 · 0 评论 -
swing窗体-登陆界面效果
package register;import java.awt.EventQueue;import javax.swing.JFrame;import javax.swing.JLabel;//import java.awt.BorderLayout;import javax.swing.SwingConstants;//import java.awt.FlowLayout;i...原创 2018-02-21 16:20:13 · 932 阅读 · 0 评论 -
JFrame窗体练习2
package swing;import java.awt.*;import javax.swing.*;public class JFrameTest extends JFrame { public void CreateJFrame(String title) { JFrame jf=new JFrame(title); Container c =jf.getConte...原创 2018-02-18 14:55:54 · 483 阅读 · 0 评论 -
BorderLayout布局
package window01;import javax.swing.*;import java.awt.*;public class BorderLayoutTest { public static void main(String[] args) { JFrame f = new JFrame("测试窗口"); // 设置Frame容器使用Border...原创 2018-02-18 16:37:25 · 604 阅读 · 0 评论 -
sayhello对话框练习
package sayHello;import javax.swing.*;import java.awt.*;import java.awt.event.*;public class Main extends JFrame { JButton bt1 =new JButton("说你好"); JLabel lb =new JLabel(); public Main() { ...原创 2018-02-18 12:34:49 · 414 阅读 · 0 评论 -
JTabbedPane标签容器练习
package cardlayout;import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.event.*;public class UseTabbedPane { public static void main(String[] args) { // TODO Au...原创 2018-02-16 21:03:56 · 399 阅读 · 0 评论 -
JSlider练习
package demoJSlider;import java.awt.*;import javax.swing.*;import javax.swing.event.*;public class TestJSlider extends JFrame implements ChangeListener{ JSlider jslh,jslv; JLabel jl; double...原创 2018-02-16 20:44:35 · 471 阅读 · 0 评论 -
JFrame窗体传递
主窗体代码package MainChildFrame;import javax.swing.*;import java.awt.*;import java.awt.event.*;public class MainFrame extends JFrame { JButton bt1 =new JButton("弹出子窗体"); JButton bt2 =new JButton("弹出...原创 2018-02-16 20:24:21 · 687 阅读 · 0 评论 -
Dialog对话框练习2
主窗体代码package messagebox;import javax.swing.*;import java.awt.*;import java.awt.event.*;public class Main extends JFrame { JButton bt1 =new JButton("弹出对话框"); JButton bt2 =new JButton("弹出提示对话框");...原创 2018-02-16 20:17:10 · 322 阅读 · 0 评论 -
Dialog对话框练习1
package dlg;import javax.swing.*;public class DlgTest { public static void main(String[] args) { JOptionPane.showMessageDialog(null,"这是一个提示信息", "信息",JOptionPane.INFORMATION_MESSAGE); ...原创 2018-02-16 20:03:08 · 375 阅读 · 0 评论 -
为标签设置图标
package MyImageIcon;import java.awt.Container;import java.net.URL;import javax.swing.*;public class MyImageIcon extends JFrame{ public MyImageIcon() { Container container=getContentPane(...原创 2018-03-04 13:09:19 · 563 阅读 · 0 评论