[Java] sets the icon, sets the font, and sets the interface style. jtable displays the header and cannot be edited.

Source: Internet
Author: User

// Java setting icon
Imageicon icon = new imageicon ("icon.png"); // It is placed under the root directory, Src's parent directory
Frame. seticonimage (icon. getimage ());

// Set the interface style in Java
Throws excption must throw an exception

Javax. Swing. uimanager. setlookandfeel (javax. Swing. uimanager. getsystemlookandfeelclassname ());

Use the interface style of the current system. Place the statement before the initialization object.


// Set the font in Java
TXT. setfont (new font ("sansserif", 0, 15 ));
The first parameter is the font name, the second parameter (0 normal, 1 bold, 2 italic), and the third parameter is the font size.
Setfont seems to be only valid for controls, and invalid for jframe and jpanel

// The jtable header is displayed and cannot be edited.
Tablemodel = new defaulttablemodel (tableinfostrings, tablename );
Studentable = new jtable (tablemodel) {public Boolean iscelleditable (INT row, int column) {return false ;}}; // The set text cannot be modified.

Jscrollpane = new jscrollpane (studentable );

/*

* *****

* ***** 2013.6.30

* Http://blog.csdn.net/xyydyyqf

*/

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.