- 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
Arjun Thakur has Published 1109 Articles
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
Arjun Thakur
931 Views
Use the Font class to set font for text. Let us first create JTextPane component −JTextPane textPane = new JTextPane();Now, set the font with the Font class setFont() method −Font font = new Font("Serif", Font.ITALIC, 18); textPane.setFont(font);The following is an example to set font for text −Examplepackage my; import java.awt.BorderLayout; ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
Arjun Thakur
344 Views
You can use CONCAT() for this. The syntax is as follows −insert into DemoTable values(concat(curdate(), ' yourSpecificTime’));Let us first create a table −mysql> create table DemoTable ( ArrivalDate datetime ); Query OK, 0 rows affected (1.06 sec)Insert some records in the table using insert command. We are ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
Arjun Thakur
182 Views
Use the createLoweredBevelBorder() method to create a border with a lowered beveled edge. We will set it on the label component −JLabel label; label = new JLabel("This has a border with a lowered bevel edge!"); label.setBorder(BorderFactory.createLoweredBevelBorder());The following is an example to create a border with a lowered beveled edge −Examplepackage ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
Arjun Thakur
1K+ Views
For a dialog box with Yes No Cancel buttons, you need to use the JOptionPane.showConfirmDialog(), wherein you will get a confirmation dialog box.The following is an example to create a dialog box in Java with Yes No and cancel buttons −Examplepackage my; import java.awt.Dimension; import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JOptionPane; ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
Arjun Thakur
199 Views
To get the tab size from a JTextArea, you can use the getTabSize() method −textArea.getTabSize();We will assign it to int variable and display the size in the Console −int size = textArea.getTabSize(); System.out.println("Tab Size = "+size);The following is an example to set the tab size of a JTextArea −Examplepackage my; ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
Arjun Thakur
62 Views
Let us first create a table −mysql> create table DemoTable1 ( value int ); Query OK, 0 rows affected (0.59 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1 values(10); Query OK, 1 row affected (0.17 sec)Display all records from the table using ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
Arjun Thakur
825 Views
Given a non-empty string str and an integer k , rearrange the string such that the same characters are at least distance k from each other.All input strings are given in lowercase letters. If it is not possible to rearrange the string, return an empty string "".Example 1:str = “tutorialspoint”, k = 3 Answer: “tiotiotalnprsu”The same ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
Arjun Thakur
370 Views
Let us first create a component −JLabel label1; label1 = new JLabel("Id", SwingConstants.CENTER); Now, set the tooltip for the above component − label1.setToolTipText("Enter Id");ExampleThe following is an example to add a tooltip to a component in Java −package my; import java.awt.GraphicsEnvironment; import java.awt.GridLayout; import java.awt.Point; import javax.swing.JFrame; import javax.swing.JLabel; import ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
Arjun Thakur
270 Views
To set the titled justification of the titled border, use the setTitleJustification() method. The following is an example to set the title justification of the titled border −Examplepackage my; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; import javax.swing.BorderFactory; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.border.LineBorder; import javax.swing.border.TitledBorder; public class SwingDemo { ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
Arjun Thakur
90 Views
Let us see how to set the raised SoftBevelBorder −Border raisedBorder = new SoftBevelBorder( SoftBevelBorder.RAISED, Color.GREEN, Color.GREEN.darker(), Color.MAGENTA, Color.magenta.brighter());Let us see how to set the lowered SoftBevelBorder −Border loweredBorder = new SoftBevelBorder( SoftBevelBorder.LOWERED, Color.ORANGE, Color.YELLOW.darker(), Color.BLUE, Color.yellow.brighter());The following is an example to set raised and lowered SoftBevelBorder for ... Read More