BorderLayout
FlowLayout
GridLayout
GridBagLayout
CardLayout
BoxLayout
1.BorderLayoutJava.lang.Object--java.awt.borderlayoutDivide the layout into five regions, east, west, south, north, and middle, and place the components of the add-in at the specified location.
Borderlayout.east
Borderlayout.west
Borderlayout.south
Borderlayout.north
Borderlayout.center
constructor function:BorderLayout ()Create BorderLayout with no spacing between compone
BorderLayout
FlowLayout
GridLayout
GridBagLayout
CardLayout
BoxLayout
1.BorderLayoutJava.lang.Object--java.awt.borderlayoutDivide the layout into five regions, east, west, south, north, and middle, and place the components of the add-in at the specified location.
Borderlayout.east
Borderlayout.west
Borderlayout.south
Borderlayout.north
Borderlayout.center
constructor function:BorderLayout ()Create BorderLayout with no spacing between compone
BorderLayout
FlowLayout
GridLayout
GridBagLayout
CardLayout
BoxLayout
1.BorderLayoutJava.lang.Object--java.awt.borderlayoutDivides the layout into east, west, south, north, and five regions, placing the joined components at the specified location.
Borderlayout.east
Borderlayout.west
Borderlayout.south
Borderlayout.north
Borderlayout.center
constructor function:BorderLayout ()Create BorderLayout with no spacing between componentsBorderLayout
Windows are the basis for GUI changes, and the visual components of applications that are small applications or graphical interfaces are placed in Windows. In the GUI, a window is a part of the user's screen that acts as a small screen in the screen. There are three types of windows:①applet window: Applet class manages this window, which is created and processed by the system when the application is started.② frame window (JFrame): This is the usual w
shown in A.8.Figure A.8 Installing the Windowbuilder toolA.2 Designing forms with WindowbuilderAfter you have installed the Windowbuilder tool for Eclipse, you can use Windowbuilder to design the swing program, with the following steps:(1) Create a new Java project, right-click on the Java project and choose the "new/other" shortcut menu, as shown in a.9.Figure A.9 Select the New/other shortcut menu(2) The New dialog box pops up, so the windowbuilder/swing Designer menu is expanded, and the
into eclipse, as shown in A.8.Figure A.8 Installing the Windowbuilder toolA.2 Designing forms with WindowbuilderAfter you have installed the Windowbuilder tool for Eclipse, you can use Windowbuilder to design the swing program, with the following steps:(1) Create a new Java project, right-click on the Java project and choose the "new/other" shortcut menu, as shown in a.9.Figure A.9 Select the New/other shortcut menu(2) The New dialog box pops up, so the windowbuilder/swing Designer menu is expa
This article is your own study notes, welcome reprint, but please indicate the source: http://blog.csdn.net/jesson20121020recently want to learn the Java interface programming, in this record. Most swing applications are built within the base jframe, and JFrame can create Windows apps in any operating system you work with.Look at one of the simplest jframe exampl
which we needImport javax. Swing .*;Import java. AWT .*;Public class hellocsdn{Public static void main (string [] ARGs){Hellocsdnframe frame = new hellocsdnframe ();Frame. setdefaclocloseoperation (jframe. exit_on_close );Frame. Show ();}}/** This part we construct a new frame hellocsdnframe*/-------------------------------------------------------------------------Class hellocsdnframe extends jframe {Publi
Time Dynamic Display1. method 1 use timertask
Java. util. timer and Java. util. timertask are used for dynamic updates. After all, each update can be regarded as a one-second timer.
The Code is as follows:
Import java. AWT. dimension;Import java. Text. simpledateformat;Import java. util. calendar;Import java. util. date;Import java. util. timer;Import java. util. timertask;Import javax. Swing. jframe;Import javax. Swing. jlabel;Import javax.
Five common la s of Swing and wing in java
1. Border layout (BorderLayout)
2. FlowLayout)
3. GridLayout)
4. BoxLaYout)
5. Empty layout (null)
There are two other layout S: GridBagLayout (grid package layout) and CardLayout (card layout)
Note: The default layout of JFrame and JDialog is BorderLayout, while that of JPanel and Applet is FlowLayout.
Sample Code for border layout:
Import java. awt. borderLayout; import javax. swing. JButton; import javax.
This example for you to share the Java Bookstore System graduate design 3rd, for your reference, the specific content as follows
Import java.util.List;
Import Javax.swing.JFrame;
Import Javax.swing.JOptionPane;
Import Cn.hncu.bookStore.user.business.factory.UserEbiFactory;
Import Cn.hncu.bookStore.user.vo.UserModel; /** * * @author __user__/public class Listpanel extends Javax.swing.JPanel {private static final long Serialversi
Onuid = 1L;
Private
tasks. The first task is to compare the Code required to instantiate various language interpreters. The second task is to compile a script to complete the following operations: instantiate a Java jframe and put it into a jtree, adjust the size and display the jframe. Although these tasks are simple, we can see how much work is done by using an interpreter, and what the script code compiled for the interpre
along the Y axis.Setverticaltextposition (INT textposition)Set the vertical position of the text of the label relative to the image.
Example 1: add images and text in jlabel
import java.awt.FlowLayout; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.SwingConstants; public class MixingIconLabel { public static void main(String[] args) { JFrame.setDefaultLookAndFeelDecorated(true); JFrame
isselected, Boolean cellhasfocus) {// todo auto-generated method stublistrenderer = (defaultlistcellrenderer) listrenderer. getlistcellrenderercomponent (list, Value, index, isselected, cellhasfocus); configurerenderer (listrenderer, value); Return listrenderer ;}} to demonstrate the use of the new combined Renderer and display a simple table Unit Editor, A data model is created for programs displayed in the 18-15 list, and one column is color. After the Renderer is installed twice and the tabl
).
Drag the object finder control to the place an order dialog box and move it to the title bar so that the entire dialog box is surrounded by a red box, and then release the mouse button.
Now, in the insert a GUI object into the object map dialog box, select include all available objects on this window and click Finish.
Click place order.
Your current object map should contain a javax. Swing. jframe object. Select the
. Therefore, when using the following jeditorpane2 example* Remove (set false). This hyperlink function does not work currently. This section will be introduced in jeditorpane event processing.*/Editpane. seteditable (false );Jframe F = new jframe ("jeditorpane1 ");F. setcontentpane (New jscrollpane (editpane ));F. setsize (200,200 );F. Show ();F. addwindowlistener (New windowadapter (){Public void windowcl
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.