("speciality"); Jcb1=new Jcheckbox ("Music"); Jcb2=new jcheckbox ("Sport"); jcb3= New Jcheckbox ("literary"); Jp1.add (JLB1); Jp1.add (JCB1); Jp1.add (JCB2); Jp1.add (JCB3); jp2=new JPanel () jlb2=new JLabel ("gender"); Jrb1=new Jradiobutton ("male"); Jrb2=new Jradiobutton ("female"); bg1=new Buttongroup (); Bg1.add (JRB1); Bg1.add (JRB2);//Add into group so that it can only select one Jp2.add (JLB2); Jp2.add (JRB1); Jp2.add (JRB2);//Do not add the group to Jp3=new JPanel (); jb1=new JButton ("
)) {if (flag = = False) {Jtextarea.settext (Child.getabsolutepath ());}}5. Add File name search function:A new text box is used to enter the file name, compare the resulting file name with the file name listed in FL, and add it to the files dynamic array for display.if (Fl[i].getname (). Contains (FN) !fn.equals ("")) {Files.add (Fl[i]);}6. Add the ability to open a file in the Click Results list:1. Normal JTextArea does not support the ability to click Back to click Options, so take advantage o
Job Requirements: Scan the files in the specified location from the hard disk and then display them to the graphical user interface, add a drop-down menu in the GUI interface, list box, below is my code:Import Java.awt.BorderLayout; Import Java.awt.Color; Import java.awt.Dimension; Import Java.awt.Toolkit; Import java.awt.event.ActionEvent; Import Java.awt.event.ActionListener; Import Java.io.File; Import Java.nio.file.Path; Import java.nio.file.Paths; Import java.util.ArrayList; Import java.uti
Use component JList to complete the display of specified file contents with a list componentImport java.awt.*;Import Java.io.File;Import java.util.ArrayList;Import java.util.List;Import javax.swing.*;public class Liebiao extends JFrame {Private static final String music = "File";Private JFrame frame;Private JList fileList;Public Liebiao () {string[] FileNames = findfiles (music, NULL);Makeframe (FileNames);
the drop-down list.
You can also inherit two important methods of the AbstractListModel class:
GetSize (): length of the returned list
GetElementAt (int index): returns the value at the specified index.13.7.2 JList component JList class () constructor: public void JList () provides three methods for setting items in the list box: array, Vector, and ListModel mod
Today, I wrote a small program encountered this problem, in the online search for someone else's ideas, sorting out the code can run, feel good!
A new application is created directly in JBuilder, as the specific steps do not describe, this code does not run directly without the main function. Below I post the code in FRAME1:
Import java.awt.*;
Import java.awt.event.*;
Import javax.swing.*;
Import com.borland.jbcl.layout.*;
Import Java.util.Date;
public class Frame1
Extends JFrame {
JPanel Conte
1. TasksThat is, to pursue benefits, but also to face unpredictable financial investment risks, "can not put eggs in the same basket", it is necessary to make a portfolio investment.The above calculations and comparisons can help customers make investment decisions.Customer: So can you help me to record a different type of investment, and dynamically show the current value of money?1 resultlist.setvisiblerowcount (5); // The default number of bars in JLis
I. PreparationsFirst, process the following calc functions for easy viewing. In fact, it is the renaming of variables, thanks to the help of vs2005.Input string STR, which is a byte array reference;I is the cyclic variable of the byte array.ProgramUsing the Big K as the location variable of the byte array.K limits the maximum string to 18. The original text is k N is actually the position of the character in the orders table. The orders table is actually a password table;J, the inexplicable J. I
is to see the approximate layout, the number of squares occupied by the component.Run-time display effectImport Java.awt.*;import javax.swing.*;p ublic class Gridbagdemo extends JFrame {public static void main (String args[]) {Gridbagdemo demo = new Gridbagdemo (); } public Gridbagdemo () {init (); This.setsize (600,600); This.setvisible (TRUE); } public void Init () {J1 = new JButton ("open"); J2 = new JButton ("Save"); J3 = new JButton ("Save As");
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.