Java Eighth Day

Source: Internet
Author: User

Things have been delayed so I'm learning something new these days. And then a little bit of a win. The skull is not good, I am writing a hospital procedure these days. It's all just superficial. There is no foundation but to bite. But these days are still possible. It's a little rewarding.

Today we are talking about a for loop. I'm still trying for the For loop this afternoon. Finally got it out.

static void Addwidget2jpaneltoppanel (JPanel toppanel) {

For Loop Addend Group
String[] strarray={"e:/imgicon/picture/png/001.png", "e:/imgicon/picture/png/002.png", "e:/imgicon/picture/png/003.png"};
for (int i=1;i<strarray.length;i=i+1) {
ImageIcon icon=new ImageIcon (Strarray[i]);
JButton t1=new JButton (icon);
Toppanel.add (t1);
}

The thing to note here is the amount (i<strarray.length) which means that you define how long a string[]strarray is. No more, no less.

Then there is the aspect of the transformation. After all, this is a picture converted into a button. So to assign values,

Assign the value of I to ImageIcon

The resulting JButton assigns the value of ImageIcon to JButton t1. So t1 with a buff.

At the end of the display where the display is displayed,

Layout Manager I don't understand, so I'm not too good to say

Is that the layout manager is divided by the default with the buff.

The default seems to be all borderlayout.

You can then set the content from left to right . --". SetLayout (New FlowLayout (flowlayou. left));

Spoke of the JSplitPane division

jtabbadpane--"This is what this means. Is the form of a folder.

Now do a lot of feeling thinking is: In the window you want to create a new jpanel on the window to show up. Then add the methods, controls in the JPanel. And then it's displayed. Is the big one is divided into small. Then put the small into the big Show out. Then it's better not to be too thin. Otherwise it will be cumbersome. However, we still have to follow the actual situation!

Java Eighth Day

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.