Java界面应用程序
来源:互联网 发布:蓝桥杯c语言试题及答案 编辑:程序博客网 时间:2024/05/16 01:18
package text12;import java.awt.*;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JPanel;public class text1 extends JFrame {// private JButton jbt1,jbt2,jbt3,jbt4,jbt5,jbt6; public text1(){ JPanel p1=new JPanel(); p1.setLayout(new FlowLayout()); p1.add(new JButton("Button 1")); p1.add(new JButton("Button 2")); p1.add(new JButton("Button 3")); JPanel p2=new JPanel(); p2.setLayout(new FlowLayout()); p2.add(new JButton("Button 4")); p2.add(new JButton("Button 5")); p2.add(new JButton("Button 6")); setLayout(new FlowLayout()); add(p1); add(p2); } public static void main(String[] args){ JFrame frame=new text1(); frame.pack(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setTitle("Exercise 12_1"); frame.setLocationRelativeTo(null); frame.setVisible(true); }}
package text12;import java.awt.FlowLayout;import java.awt.GridLayout;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JPanel;public class text2 extends JPanel { public text2(){ add(new JButton("Button 1")); add(new JButton("Button 2")); add(new JButton("Button 3")); setLayout(new FlowLayout()); } public static void main(String[] args){ JFrame frame=new JFrame(); JPanel p=new JPanel(new GridLayout(2, 1,5,5)); text2 p1=new text2(); text2 p2=new text2(); p.add(p1); p.add(p2); frame.add(p); frame.pack(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); frame.setVisible(true); }}``package text12;import java.awt.Color;import java.awt.FlowLayout;import java.awt.GridLayout;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JPanel;import javax.swing.border.LineBorder;public class text3 extends JPanel{ public text3(){ setLayout(new GridLayout(4,1)); JLabel l1=new JLabel("Department of Computer Science"); l1.setBorder(new LineBorder(Color.blue,1)); JLabel l2=new JLabel("School of Computing"); l2.setBorder(new LineBorder(Color.GRAY,1)); JLabel l3=new JLabel("Armstong Atlanfic"); l3.setBorder(new LineBorder(Color.RED,1)); JLabel l4=new JLabel("Tel(912)921-6440"); l4.setBorder(new LineBorder(Color.black,1)); add(l1); add(l2); add(l3); add(l4); } public static void main(String[] args){ JFrame frame=new JFrame(); text3 p=new text3(); frame.add(p); frame.setTitle("Exercise12_5"); frame.pack(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); frame.setVisible(true); }}
package text12;
import java.awt.*;
import javax.swing.*;
import javax.swing.border.LineBorder;
public class text4 extends JPanel{
private ImageIcon usIcon=new ImageIcon(“D:\tu\b.jpg”);
private ImageIcon myIcon=new ImageIcon(“D:\tu\c.jpg”);
private ImageIcon frIcon=new ImageIcon(“D:\tu\d.jpg”);
private ImageIcon ukIcon=new ImageIcon(“D:\tu\e.jpg”);
public text4(){
setLayout(new GridLayout(2,2,1,1));
JLabel l1=new JLabel(usIcon);
JLabel l2=new JLabel(myIcon);
JLabel l3=new JLabel(frIcon);
JLabel l4=new JLabel(ukIcon);
l1.setBorder(new LineBorder(Color.BLUE,1));
l2.setBorder(new LineBorder(Color.BLUE,1));
l3.setBorder(new LineBorder(Color.BLUE,1));
l4.setBorder(new LineBorder(Color.BLUE,1));
add(l1);
add(l2);
add(l3);
add(l4);
}
public static void main(String[] args){
JFrame frame=new JFrame();
text4 p=new text4();
frame.add(p);
frame.pack();
frame.setSize(200,200);
frame.setTitle(“Exercise12_6”);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
package text12;import java.awt.*;import javax.swing.*;public class text5 extends JFrame{ public text5(){ //ImageIcon icon = new ImageIcon("d:\\tu\\c.jpg"); JButton button = new JButton("beauty"); button.setIcon(new ImageIcon("d:\\tu\\c.jpg")); add(button); setLayout(new FlowLayout()); } public static void main(String[] args){ text5 frame= new text5(); frame.pack(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setExtendedState(JFrame.MAXIMIZED_BOTH); frame.setLocationRelativeTo(null); frame.setVisible(true); }}
- Java界面应用程序
- Java 桌面应用程序 启动界面
- 实现一个Java GUI计算器应用程序界面
- Ext4+Java构建Web应用程序后台经典界面
- 给Java的Swing应用程序界面换漂亮的皮肤
- 给Java的Swing应用程序界面换漂亮的皮肤
- Ext4+Java构建Web应用程序后台经典界面
- Ext4+Java构建Web应用程序后台经典界面
- 打印java应用程序的界面.可以指定是这个界面中的任何一个组件.
- Excel应用程序界面
- iPhone应用程序界面结构
- 应用程序的splash界面
- android无界面应用程序
- Android应用程序启动界面
- 创建多界面的应用程序
- 5-多文档界面应用程序
- 避免应用程序界面卡死
- 创建漂亮的应用程序界面
- SSh Agent admitted failure to sign using the key
- 哈夫曼编码原理以及实现
- Leetcode283. Move Zeroes
- 程囧(二)
- Android View的getLeft, getRight, getTop, getBottom
- Java界面应用程序
- POJ2337 Catenyms 字典序输出欧拉路径
- 新手学习selenium 2.0+python 2.7.11+firefox46的环境配置
- 在MFC上显示mat格式图片
- spring 源码探索--bean加载准备阶段
- 《算法》之惊鸿一瞥
- 数据结构——二叉树的直径
- JavaScript
- bzoj1061