example, there is an application that displays a list of Java.util.Locale objects to the user, who can change the locale of the application by selecting items in the list.Imagine how jlist would display a data model that contained a locale object? JList delegate Javax.swing.ListCellRenderer to display these objects. As we expected, Listcellrenderer will display
Make a cooler JList interface
Content:1. The working principle of the drawing device.2. Replace the appearance of JList and JComboBox with a custom drawing.3. Let the new look respond to mouse events.
With the swing system's MVC design concept, it's easy to replace different skins for components. This article mainly takes jlist and JComboBox as an
(pane, BorderLayout. CENTER );Frame. getContentPane (). add (list. getFilterField (), BorderLayout. NORTH );Frame. pack ();Frame. setVisible (true );Frame. setdefaclocloseoperation (JFrame. EXIT_ON_CLOSE );}
[Summary]Here, we only add a specific layer of functionality to a JList. Of course, we can't just learn how to compile the code for this function, but also understand how to implement it internally, why?Do this.Here, the Inheritance Mechanism and
I have not mastered the right-click menu in some components for a long time, and I have always felt quite difficult (it really seems that I am stupid, but I am in a daze spirit, and I succeeded today, but it will be nice to understand it later. So let's take a look at it and share it with you. 1: define variables. Jlist; jpopupmenu; jmenuitem; jsonjradiobuttonmenuitem; jcheckboxmenuitem; jseparator; 2: Initialize member variables. Saving, no writing.
Swing custom jlist
First, explain
Each entry in the middle is a cell. Here we use jpanel to display the cell, so we can add buttons, labels, and checkbox on the panel... Do what you want.
Click remove to delete the current row.
Complete engineering http://download.csdn.net/detail/jasper_success/4488517
Key code
/*** Custom jlist. Each cell is a component, which can be defined at will, for
Use of JList
JList compared to Jcheckbox, you can select a maximum of one item, and JList can be selected as a whole column .
The third constructor cannot change the number of items
--Construct a simple listImportJava.awt.Container;Importjava.awt.GridLayout;ImportJava.awt.event.WindowAdapter;Importjava.awt.event.WindowEvent;ImportJava.util.Vect
A list box can also be used to create a list box when information is presented to the user's list of multiple options, using JList.Package Com.beyole.util;import Java.awt.container;import Java.awt.gridlayout;import java.awt.event.WindowAdapter; Import Java.awt.event.windowevent;import Java.util.vector;import Javax.swing.borderfactory;import Javax.swing.jframe;import Javax.swing.jlist;import javax.swing.listselectionmodel;class MyList {private JFrame frame = new JFrame ("Beyole");p rivate Contain
processing. The parent container chooses to continue forwarding or process the request.
The scrollrecttovisible function receives only one rectangle parameter, indicating which region you want to be visible. For jtable, obtain the required parameters in the following way:
Int x = jtable1.getbounds (). X;
Int y = jtable1.getrowheight () * rowindex;
Int width = jtable1.getbounds (). width;
Int Height = jtable1.getrowheight ();
Jtable1.scrollrecttovisible (New rectangle (X, Y, width, height ));
1. Define JList
2. Add mouse Monitor on the JList object (MouseListener)
3. After the Click event is triggered, determine its position in the jlist, and then determine the number of hits, depending on the number of times to select the processing function.
String data[] = {"Red", "Blue", "green"};
JList
OK, I admit that the word "dynamic" is used a bit. Let's take a look at the effect and explain it first. There is nothing dynamic in the picture. In fact, the effect is that when the item is selected in this way, the selected blue background changes
This article mainly introduces the example of using the Pythonjson module. This article provides multiple code examples. For more information, see JSON, which is a string representation of the Python dictionary, however, the dictionary cannot be directly transmitted as a complex object, so it must be converted into a string. the conversion process is also a serialization process.
Serialized in json. dumps format
The code is as follows:
>>> Import js
Python decorator use example and actual application example, python example
Test 1
Deco is running, but myfunc is not running
Copy codeThe Code is as follows:Def deco (func ):Print 'before func'Return func
Def myfunc ():Print 'myfunc () called'Myfunc = deco (myfunc)
Test 2
Call myfunc in the required deco to executeCopy codeThe Code is as follows:Def deco (func
/*======================================================================
A Globalmem Driver As an example of char device drivers
There are two same globalmems in this driver
This example was to introduce the function of File->private_data
The initial developer of the original code is Baohua Song
======================================================================*/
#include #include #include #include #in
Remember when a friend wanted his VFP program to run this way: There is no VFP main screen (_screen), the runtime directly on the desktop, a login dialog box, enter the user name and password and verify the software after the main interface, looks like the software written in VB, a very cool feeling.
The main interface of VFP software can usually be implemented in two ways: the main screen (_screen) or the top-level form (or the parent-child form). You can use the top level form to implement th
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.