Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Java Program to create JRadioButton from text

karthikeya Boyini
Answered 10h 51m ago

The following is an example to create JRadioButton from text −Examplepackage my; import java.awt.FlowLayout; import java.awt.event.KeyEvent; import javax.swing.ButtonGroup; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JRadioButton; public class SwingDemo {    public static void main(String[] args) {       JRadioButton radio1 = new JRadioButton("Cricket");       JRadioButton radio2 = new ... Read More

How to add background Image to JFrame in Java

Samual Sam
Answered 10h 54m ago

To add background image to JFrame, use the getImage() method of the Image class −Image img = Toolkit.getDefaultToolkit().getImage("E:\\rahul.jpg");Now, draw the image −public void paintComponent(Graphics g) {    super.paintComponent(g);    g.drawImage(img, 0, 0, null); }The following is an example to add Background Image to JFrame −Exampleimport java.awt.Graphics; import java.awt.Image; import java.awt.Toolkit; ... Read More

How to maximize JFrame in Java Swing

karthikeya Boyini
Answered 11h 16m ago

To maximize JFrame in Java Swing, use the following −JFrame.MAXIMIZED_BOTHThe following is an example to maximize JFrame in Java −Examplepackage my; import javax.swing.JFrame; import javax.swing.JPanel; public class SwingDemo extends JFrame {    JPanel panel = new JPanel();    public SwingDemo() {       setVisible(true);       setDefaultCloseOperation(EXIT_ON_CLOSE);   ... Read More

How to create JFrame with no border and title bar in Java?

Samual Sam
Answered 11h 18m ago

To create a JFrame with no border and title bar, use setUndecorated() −JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setPreferredSize(new Dimension(400, 300)); frame.setUndecorated(true);The following is an example to create JFrame with no border and title bar −Exampleimport java.awt.Dimension; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public ... Read More

How to activate and deactivate JFrame in Java

karthikeya Boyini
Answered 11h 20m ago

Here, we are activating a frame. For deactivation, we have used dispose −Thread.sleep(2000); frame.setVisible(false);The frame first activates and then deactivates after 2 seconds since we have set sleep to 2000 miliseconds.The following is an example to activate and deactivate JFrame −Exampleimport java.awt.Frame; import javax.swing.JFrame; import javax.swing.JLabel; public class SwingDemo { ... Read More

How to get Directories from JFileChooser in Java

Samual Sam
Answered 11h 21m ago

To get directories from JFileChoose, use the mode setFileSelectionMode −JFileChooser file = new JFileChooser(); file.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);The following is an example to get Directories from JFileChooser −Exampleimport javax.swing.JFileChooser; public class SwingDemo {    public static void main(String[] args) {       JFileChooser file = new JFileChooser(); file.setMultiSelectionEnabled(false);         ... Read More

Java Program to display the contents in JTextArea

karthikeya Boyini
Answered 11h 23m ago

The following is an example to display the contents of a text file in JTextArea −Exampleimport java.awt.*; import java.awt.event.*; import javax.swing.*; public class SwingDemo {    private JFrame mainFrame;    private JLabel statusLabel;    private JPanel controlPanel;    public SwingDemo() {       prepareGUI();    }    public static ... Read More

How to create FileFilter for JFileChooser in Java and display File Type accordingly?

Samual Sam
Answered 11h 28m ago

To create FileFilter, use the FileNamExtensionFilter class. The following is an example to display File Type in JFileChooser −Exampleimport javax.swing.JFileChooser; import javax.swing.filechooser.FileNameExtensionFilter; public class SwingDemo {    public static void main(String[] args) {       JFileChooser file = new JFileChooser();       file.setAcceptAllFileFilterUsed(false);       FileNameExtensionFilter extFilter ... Read More

Token Passing in Bit-Map Protocol

Vikyath Ram
Answered 12h 51m ago

Bit-map protocol is a collision free protocol that operates in the Medium Access Control (MAC) layer of the OSI model. It resolves any possibility of collisions while multiple stations are contending for acquiring a shared channel for transmission. In this protocol, if a station wishes to transmit, it broadcasts itself ... Read More

What is RSVP (Resource Reservation Protocol)?

Rishi Raj
Answered 12h 58m ago

RSVP is a transport layer protocol that is used to reserve resources in a computer network to get different quality of services (QoS) while accessing Internet applications. It operates over Internet protocol (IP) and initiates resource reservations from the receiver’s end.FeaturesRSVP is a receiver oriented signalling protocol. The receiver initiates ... Read More

Reservation Protocols in Computer Network

Arushi
Answered 13h 3m ago

Reservation protocols are the class of protocols in which the stations wishing to transmit data broadcast themselves before actual transmission. These protocols operate in the medium access control (MAC) layer and transport layer of the OSI model.In these protocols, there is a contention period prior to transmission. In the contention ... Read More

Bit-Map Protocol

Vikyath Ram
Answered 13h 8m ago

Bit-map protocol is a collision free protocol that operates in the Medium Access Control (MAC) layer of the OSI model. It resolves any possibility of collisions while multiple stations are contending for acquiring a shared channel for transmission.In this protocol, if a station wishes to transmit, it broadcasts itself before ... Read More

Collision-Free Protocols

Arushi
Answered 14h 18m ago

In computer networks, when more than one station tries to transmit simultaneously via a shared channel, the transmitted data is garbled. This event is called collision. The Medium Access Control (MAC) layer of the OSI model is responsible for handling collision of frames. Collision – free protocols are devised so ... Read More

Fesetround() and fegetround() in C++

Anvi Jain
Answered 13h 51m ago

Here we will see the fesetround() and fegetround() method in C++. These methods can be found in the cfenv library.The fesetround() method is used to set the specified floating point rounding direction to the current rounding direction. This is used with rint(), nearbyint() and some other rounding functions in C++.The ... Read More

Hiding of all overloaded methods in base class in C++

Nishtha Thakur
Answered 13h 54m ago

In C++, we can use the function overloading techniques. But if some base class has one method in overloaded form (different function signature with the same name), and the derived class redefines one of the function which is present inside the base, then all of the overloaded version of that ... Read More

Advertisements
Loading...
Unanswered Questions View All

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.