To place a picture in the graphical interface, you need to use the window splitter JSplitPane (belonging to the container class component) to the interface above the imageicon. Split the window into two columns. A column is JList, inside entered some text, a column is jlable, above place the picture. The layout uses the Borderlayoutpackage gui;import java.awt.borderlayout;import javax.swing.jframe;import Javax.swing.jlabel;import Javax.swing.jsplitpan
Displays all files under the specified directory in the list box (JList) component,Following
Importjava.awt.BorderLayout;ImportJava.io.File;ImportJavax.swing.JComboBox;ImportJavax.swing.JFrame;Importjavax.swing.JList;ImportJavax.swing.JScrollPane; Public classKuang { Public Static voidListdrectory (File dir)throwsillegalaccessexception {JFrame frm=NewJFrame ("Drop down combo box"); Frm.setdefaultcloseoperation (Jframe.exit_on_close); Frm.
In the project, you need to use a drop-down tree to select a space. You have improved a lot by referring to other people. The usage is as follows:
Treecombobox TCB = new treecombobox (); you can create a simple drop-down tree. The drop-down tree is the original tree.
The source code of treecombobox is as follows:
Import java. AWT. borderlayout;Import java. AWT. color;Import java. AWT. component;Import java. AWT. dimension;Import java. AWT. illegalcomponentstateexception;Import java. AWT. event.
serialization list as a JSON string format
Copy Code code as follows:
>>> list = [1, 4, 3, 2, 5]
>>> jlist = json.dumps (list)
>>> Print JList
[1, 4, 3, 2, 5]
The list and jlist types are also different.
Copy Code code as follows:
>>> type (list)
>>> type (jlist)
as a json stringCopy codeThe Code is as follows:>>> List = [1, 4, 3, 2, 5]>>> Jlist = json. dumps (list)>>> Print jlist[1, 4, 3, 2, 5]The list and jlist types are also different.Copy codeThe Code is as follows:>>> Type (list)>>> Type (jlist)
Json. dumps has the following parameters:Copy codeThe Code is as follows:Json
string format
Copy CodeThe code is as follows:
>>> list = [1, 4, 3, 2, 5]
>>> jlist = json.dumps (list)
>>> Print JList
[1, 4, 3, 2, 5]
The list and jlist types are also different
Copy CodeThe code is as follows:
>>> type (list)
>>> type (jlist)
Jso
:
>>> Type (jdic)
>>> Type (jdict)
Json. dumps Serialization list can be used as a json string
The code is as follows:
>>> List = [1, 4, 3, 2, 5]>>> Jlist = json. dumps (list)>>> Print jlist[1, 4, 3, 2, 5]
The list and jlist types are also different.
The code is as follows:
>>> Type (list)
>>> Type (
Today we will focus on JSpinner and JList. JSpinner is rarely used. Generally, it is replaced by a scroll bar, but when the value is precise, it is embarrassing to use a scroll bar to often fail to get its own value, then JSpinner will be used.
In fact, JSpinner has no tricks. During the main construction, a SpinnerModel should be passed. This class has three subclasses.
The SpinnerNumberModel is used to set the numeric JSpinner.
The SpinnerDateModel
JSON is actually a string representation of a Python dictionary, but a dictionary cannot be passed directly as a complex object, so it needs to be converted to a string. The process of conversion is also a serialization process.Serialize to JSON string format with Json.dumps>>>ImportJson>>>DIC {' Connection ': [' keep-alive '],' Host ': [' 127.0.0.1:5000 '],' Cache-control ': [' max-age=0 ']}>>>Jdict = Json.dumps ({' Connection ': [' keep-alive '],' Host ': [' 127.0.0.1:5000 '],' Cache-control '
list boxes and combo boxes work in swing just as they do in old AWT, but they are also added if we need it. In addition, it is also more convenient and easy to use. For example, JList has a builder that displays a string array (oddly, the same functionality is not valid in JComboBox!). )。 The following examples show their basic usage.
: Listcombo.java
//List Boxes Combo boxes
package c13.swing;
Import java.awt.*;
Import java.awt.event.*;
Import
type is the same as the element type in Rdd, and is mainly converted by the map of the keyby function, converting each element into an element of the tuples type; the second parameter is ascending, which is an optional argument , mainly used for sorting the elements in Rdd, the default is true, ascending, and the third parameter is Numpartitions, which is also an optional parameter, which is mainly used to partition the sorted Rdd, and the default number of partitions is the same as before the
Want to do a Java like windows in the same TXT editing software, related to the Font Settings tab, found on the internet for a long time did not find, angry at their own write a, now posted here to share, the next time you encounter such problems do not have to personally hit the code!
Package experiment;
Import java.awt.*;
Import java.awt.event.ActionEvent;
Import Java.awt.event.ActionListener;
Import Java.awt.event.MouseAdapter;
Import java.awt.event.MouseEvent;
Import javax.swing.*;
I
JSON is actually a string representation of a Python dictionary, but a dictionary cannot be passed directly as a complex object, so it needs to be converted to a string. The process of conversion is also a serialization process.
Serialize to JSON string format with Json.dumps
>>> import json>>> dic {' Connection ': [' keep-alive '], ' Host ': [' 127.0.0.1:5000 '], ' cache-control ': [' Max-age=0 ']}>>> jdict = json.dumps ({' Connection ': [' keep-alive '], ' Host ': [' 127.0.0.1:5000 '], ' Cach
I don't know when. The carousel effect is popular on the webpage.At present, swing has not seen any related performance components... today I wrote ..
Dynamically scroll the component to a certain direction ..
In fact, it is not difficult to analyze ..Two jbuttons, one JList, and one JScrollPanel. You can do it in the next animation.Because I used my own extension package... so in some places, you can change it... for example, change IButton to JButt
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.