Swing
专注学习java
学习不进则退
展开
-
树处理展开节点事件(简单代码例子实现)
import java.awt.*;import javax.swing.*;import javax.swing.event.*;import javax.swing.tree.*;public class Main extends JFrame { /** * */ private static final long serialVersionUID = 1L; private JTree tree; public static void main(String a原创 2020-08-12 18:41:35 · 561 阅读 · 0 评论 -
维护树模型(DefaultTreeModel )(简单代码例子实现)
import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.tree.*;public class Main extends JFrame { /** * */ private static final long serialVersionUID = 1L; private JTextField textField; private DefaultTreeModel原创 2020-08-12 18:35:08 · 1326 阅读 · 1 评论 -
数(简单的数、处理节点事件、遍历树)(简单代码例子实现)
import java.awt.*;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.util.*;import javax.swing.*;import javax.swing.event.TreeSelectionEvent;import javax.swing.event.TreeSelectionListener;import javax.swing.tree.Defa原创 2020-08-12 16:34:21 · 121 阅读 · 0 评论 -
工具栏(JToolBar )、文本选择器、进度条(JProgressBar )、系统托盘(TrayIcon )和桌面集成控件(Desktop )(简单代码例子实现)
import java.awt.AWTException;import java.awt.BorderLayout;import java.awt.Container;import java.awt.Desktop;import java.awt.Dimension;import java.awt.GridLayout;import java.awt.Image;import java.awt.MenuItem;import java.awt.PopupMenu;import java.a原创 2020-08-16 14:07:56 · 238 阅读 · 0 评论 -
菜单(JJMenuBar(菜单栏),JMenu,JMenuItem)(简单代码例子实现)
import java.awt.*;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.KeyEvent;import java.awt.event.MouseAdapter;import java.awt.event.MouseEvent;import java.awt.event.MouseListener;import java.net.*;impor原创 2020-08-14 16:32:07 · 1377 阅读 · 0 评论 -
分割面板、选项卡、桌面面板和内部窗体(JSplitPane 、JTabbedPane 和JDesktopPane )(简单代码例子实现)
分割面板代码实例展示:import java.awt.BorderLayout;import java.awt.Container;import java.sql.Connection;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JSplitPane;public class Main extends JFrame{ public Main() { setTitle("分割面板");原创 2020-08-13 16:16:56 · 417 阅读 · 0 评论 -
提供标题栏的表格(就是保持标题的首行首列冻结)
类Main中的代码import java.awt.*;import java.util.*;import javax.swing.*;public class Main extends JFrame { /** * */ private static final long serialVersionUID = 1L; public static void main(String args[]) { try { Main frame = new Main();原创 2020-08-11 17:54:59 · 275 阅读 · 0 评论 -
表格模型(DefaultTableModel)(简单代码例子实现)
import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.event.TableModelEvent;import javax.swing.event.TableModelListener;import javax.swing.table.*;public class Main extends JFrame { /** * */ private static final l原创 2020-08-11 17:40:01 · 2235 阅读 · 0 评论 -
利用JTable直接创建表格(简单代码例子实现)
import java.awt.BorderLayout;import java.awt.Color;import java.awt.Container;import javax.swing.JFrame;import javax.swing.JScrollBar;import javax.swing.JScrollPane;import javax.swing.JTable;import javax.swing.ListSelectionModel;public class Main原创 2020-08-11 16:06:43 · 562 阅读 · 0 评论 -
一个简单的登录窗体
import java.awt.*;import java.awt.event.*;import javax.swing.*;public class Main extends JFrame { private static final long serialVersionUID = 1L; public Main() { setTitle("登录窗体");//设置窗口标题 setBounds(300, 200, 300, 150);//设置窗口大小(x,原创 2020-07-26 12:32:03 · 274 阅读 · 0 评论 -
常用事件监听器(动作事件监听器(ActionListener)和焦点事件监听器(FocusListener))(简单代码例子实现)
import java.awt.Color;import java.awt.Container;import java.awt.FlowLayout;import java.awt.Font;import java.awt.GridLayout;import java.awt.Image;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.FocusEvent原创 2020-07-25 19:22:41 · 1131 阅读 · 0 评论 -
文本组件(文本框JTextField、密码框JPasswordField和文本域JTextArea)(简单代码例子实现)
import java.awt.Color;import java.awt.Container;import java.awt.FlowLayout;import java.awt.Font;import java.awt.GridLayout;import java.awt.Image;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.*;public c原创 2020-07-25 18:44:12 · 532 阅读 · 0 评论 -
列表组件(JList列表框和JComboBox下拉列表框组件)(简单代码例子实现)
import java.awt.Container;import java.awt.FlowLayout;import java.awt.GridLayout;import java.awt.Image;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.*;public class Main extends JFrame{ public Main() {原创 2020-07-25 16:45:06 · 470 阅读 · 0 评论 -
按钮组件(简单代码例子实现)
import java.awt.Color;import java.awt.Container;import java.awt.FlowLayout;import java.awt.GridLayout;import java.awt.Image;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.*;public class Main extends JFra原创 2020-07-25 11:28:35 · 510 阅读 · 0 评论 -
JScrollPane面板(是带有滚动条的面板)(简单代码的例子实现)
import java.awt.Container;import javax.swing.*;public class Main extends JFrame{ public Main() { setBounds(100, 100, 500, 300); setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible(true); Container c = getContentPane(); JTextArea t =原创 2020-07-25 10:26:04 · 305 阅读 · 0 评论 -
JPanel面板(简单的代码例子实现)
import java.awt.BorderLayout;import java.awt.Color;import java.awt.Container;import java.awt.GridLayout;import javax.swing.*;public class Main extends JFrame{ public Main() { setBounds(100, 100, 500, 300); setDefaultCloseOperation(EXIT_ON_CL原创 2020-07-24 15:44:35 · 549 阅读 · 0 评论 -
网格组布局(简单的概括了几个用法)
import java.awt.Color;import java.awt.Container;import java.awt.GridBagConstraints;import java.awt.GridBagLayout;import java.awt.Insets;import javax.swing.*;public class Main { JFrame f = new JFrame(); Container c; void createFrame() {原创 2020-07-23 15:33:01 · 182 阅读 · 0 评论 -
图片的插入(JLable)
import java.awt.Container;import java.awt.Image;import java.net.URL;import javax.swing.*;public class Main extends JFrame{ public Main() { setBounds(200, 200, 500, 500);//设置窗体坐标和大小 单位:像素 setDefaultCloseOperation(EXIT_ON_CLOSE);///设置窗体的关闭方式 set原创 2020-07-23 13:28:48 · 1573 阅读 · 1 评论 -
JLable标签的使用
import java.awt.Color;import java.awt.Container;import java.awt.Font;import javax.swing.*;public class Main extends JFrame{ public Main() { setBounds(200, 200, 200, 200);//设置窗体坐标和大小 单位:像素 setDefaultCloseOperation(EXIT_ON_CLOSE);///设置窗体的关闭方式 C原创 2020-07-23 12:30:43 · 725 阅读 · 0 评论 -
JDialog对话框窗体(简单代码例子实现)
import java.awt.Color;import java.awt.Container;import java.awt.FlowLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.*;public class Main extends JDialog{ public Main(JFrame jframe) { //第一个参数:父窗体原创 2020-07-22 17:02:42 · 454 阅读 · 0 评论 -
JFrame窗体(简单的代码例子实现)
import java.awt.Color;import java.awt.Container;import javax.swing.*;public class Main { public static void main(String[] args) { JFrame f = new JFrame("你好");//创建窗体对象 f.setVisible(true);//设置窗体可见 /* * EXIT_ON_CLOSE:隐藏窗口,并停止程序 * DO_NOT原创 2020-07-22 16:18:06 · 854 阅读 · 0 评论