Today, I met a depressing thing:A jlist element is placed on a jframe, and this jlist element adds a mouse event:mousereleased, mousepressed ...Among them, in mousereleased, a pop-up menu is displayed primarily. In mousepressed, enter whether the user presses the left or right button.But I found a strange thing,When I set the current interface to:Uimanager.setlookandfeel ("Com.sun.java.swing.plaf.windows.Wi
fixed colors. Then, when you select a color, we can return the corresponding color value to the table model. Defaultcelleditor provides a jcombobox for this situation. After configuring the correct display color of the listcellrenderer in jcombobox, we will have a tablecelleditor to select the color. Figure 18-13 shows possible results.Note: All options can be redefined at any time. We can use defaultcelleditor to use jcombobox as our editor.The tablecellrenderer class for color column events a
Source code Download Link: http://download.csdn.net/detail/sky453589103/9514686If you have any questions, please leave a message.The main window uses the JList control, after displaying the logged in with the person information, next is the friend's list.In order to facilitate the future expansion, I put my friend's information encapsulated in the friendinformation, Friendinformation class definition is very simple, can read.Let's step through the Mai
under dir of the specified directory and output (1.list (); 2.listFiles ()) use the list () method to implementstring[] FileName = Dir.list ();for (String s:filename) {System.out.println (dir+ "/" +s);}System.out.println ();use the listfiles () method to implement all file names that are listed in the directory onlyfile[] files = dir.listfiles ();for (File file:files) {if it is a file, the outputif (File.isfile ()) {System.out.println (file);}}JFrame a =new JFrame (" file directory ");A.setdefa
specified text with a status of not selected.Jradiobutton (String text, Boolean selected)Creates a radio button with the specified text and selection state.Jradiobutton (String Text, icon icon)Creates a radio button that has the specified text and image and is initialized to no selection.Jradiobutton (String Text, Icon icon, Boolean selected)Creates a radio button with the specified text, image, and selection state.Use buttons, labels, drop-down menus, password boxes, text boxes, radio buttons
settingsgetHelpTopic(): Look at the information displayed when the method name is for help, which is useless tocreateComponent(): component creation and initial data configurationapply(): When the configuration interface clicks on the Apply button below the method is called, it is usually here to save the modified datareset(): Configuration Interface Click Reset in the upper right corner to call this method, general restore initialization dataWhen you design the interface, sometimes you need to
Existing applications provide users with the ability to query, list, download and display pictures from the Flickr site. Users can output query keywords, apply calls to the rest API to query Flickr for matching thumbnail images, and users can choose from thumbnail images to view larger and more detailed pictures. The query results for existing applications are as follows:
Figure 1. Application UI with query results
This UI is composed of the following components, in order from top to botto
4 classes, as shown in the following table:
Class name
MyFrame
Audioplay
Gifpanel
Test
Function
Interface GUI
Play audio files
A panel that holds GIF pictures
Test class
1. Generate Application GUI
First, use JBuilder's wizard to automatically generate a application with a menu bar, and then add controls to the frame. As shown below:
jlist
jbutton
jbutton
the program to express the following:
JFrame sampleFrame = new JFrame("Sample Frame for Manager Layout"); JPanel panelDataContent = new JPanel(); // 数据组件容器 JPanel panelDataList = new JPanel(); // 数据列表容器 JList listData = new JList(); /* 注释1 这里应该是使用布局管理把listData放在panelDataList上 */ JPanel panelDataEditor = new JPanel(); // 数据编辑组件容器 JTextField editData1 = new JTextField(); //...... // some other edit controls
Data
JComboBox
ComboBoxModel
Application Data
JProgressBar
BoundedRangeModel
GUI State/Application Data
Jscrollbar
BoundedRangeModel
GUI State/Application Data
JSlider
BoundedRangeModel
GUI State/Application Data
JTabbedPane
Singleselectionmodel
GUI State
JList
Listmodel
Application Data
indicates that the mouse is pressed, and then the ActionEvent event indicates that the mouse has been released. But the cursor is still on the button, and finally the ChangeEvent event, indicating that the cursor has left the button. However, an application typically only handles a single ActionEvent event that presses the full action of a button.
Table 11-1 Components and event types
Event Type
component
description
actionevent
j=0;jList[j]=otherlist.list[j].getcopy ();
}
}
public abstract int Seqsearch (dataelement seqitem);
public abstract void Insert (Dataelement insertitem);
public abstract void Remove (dataelement removeitem);
}
When you see the end of the code, you find out that this class is actually an abstract class, why do you define it this way? This is what we do for different types: sequential and non sequential tables. It is not difficult to imagine some of th
components, and basic components. top-level container : Jframe,jdialog,japplet,jwindow. The so-called top-level container, which is the window component that was previously spoken, can be displayed independently. Intermediate container : Jpanel,jscrollpane,jsplitpane,jtoolbar. The so-called intermediate container means those components that can act as vectors but cannot be displayed independently, that is, some basic components can be relied upon, but they cannot be displayed independently. Mus
AWT are heavyweight, or that sentence, the components in swing are vastly improved in every way compared to AWT. In the implementation of interactive components, Swing components include JButton, ComboBox, JList, JMenu, JTextArea, and JTextField in the display aspect, implementing non-editable components including JLabel and JProgressBar components Implement editable display components including JColorChooser, Jfilechoose, JFileChooser, and JTable.Sw
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.