- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
George John has Published 1167 Articles
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
George John
293 Views
To display the default font of the tabs, you need to use the Font class. Let’s say we created a JTabbedPane in Java −JTabbedPane tabbedPane = new JTabbedPane();Now, set the Font with font face, style and font size −Font font = new Font("Arial", Font.CENTER_BASELINE, 20); tabbedPane.setFont(font);The following is an example ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
George John
172 Views
Use the str_to_date() method −select month(str_to_date(yourColumnName, '%b')) from yourTableName;Let us first create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, MonthName varchar(100) ); Query OK, 0 rows affected (0.76 sec)Insert some records in the table using insert command −mysql> insert ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
George John
990 Views
To increase the row height, use the setRowHeight() method for a table in Java. Row height is the height of the row in pixels.Let’s say the following is our table −DefaultTableModel tableModel = new DefaultTableModel(); JTable table = new JTable(tableModel);Set the rows and columns and increase the row height by ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
George John
191 Views
Use the getChildCount() method to count the number of root node in a JTree. Here, our root node is “node”. Therefore to count its child node, use −System.out.println("Number of children of node = " + node.getChildCount());We have displayed the count in the Console as shown above. The following is an ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
George John
1K+ Views
To disable a MenuItem, use the setEnabled() method and set it to FALSE. Let’s say we have the following MenuBar −JMenuBar menuBar = new JMenuBar();Now, create a Menu −JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic(KeyEvent.VK_F); menuBar.add(fileMenu);We will now create two MenuItems inside the above Menu −JMenuItem menuItem1 = new JMenuItem("New", KeyEvent.VK_N); ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
George John
677 Views
Use the concept of DATE_SUB(). Let us first create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, ArrivalDate datetime ); Query OK, 0 rows affected (1.02 sec)Note: Let’s say the current date is 2019-06-08Insert some records in the table using ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
George John
453 Views
Let us first create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, StudentName varchar(20) ); Query OK, 0 rows affected (1.23 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(StudentName) values('John'); Query OK, 1 row affected ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
George John
213 Views
To make JTable single selectable in Java, you need to set the selection mode to be SINGE_SELECTION. Let’s say the following is our table −String[][] rec = { { "001", "Shirts", "40" }, { "002", "Trousers", "250" }, { "003", "Jeans", "25" }, { "004", "Applicances", ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
George John
327 Views
Let us first create a toolbar −JToolBar toolbar = new JToolBar();Now, set the orientation to create vertical toolbar −toolbar.setOrientation(SwingConstants.VERTICAL);The following is an example to create a vertical toolbar in Java −package my; import java.awt.BorderLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JTextArea; import javax.swing.JToolBar; import javax.swing.SwingConstants; public class SwingDemo { public ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
George John
249 Views
Here, we will see how to add a title to an existing Line border. Let’s say we have a label and the border is to be set −LineBorder linedBorder = new LineBorder(Color.blue); TitledBorder titledBorder = BorderFactory.createTitledBorder(linedBorder, "Demo Title"); JLabel label = new JLabel(); label.setBorder(titledBorder);The following is an example to add ... Read More