Αποτελέσματα Αναζήτησης
6 Δεκ 2013 · The import javax.swing.JFrame; line isn't recognized as a class by eclipse and will not import. The two set methods are not recognised as the JFrame will not import. I have the latest JDK and have checked that the JFrame class is existant with the shift + ctrl + T command. What is happening?
7 Ιαν 2011 · import javax.swing.*; import java.awt.*; import java.awt.geom.*; public class X { public static void main(String[] args) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new JPanel() { private final int SIZE = 200; private final int INSET = 20; @Override public Dimension getPreferredSize() { return ...
17 Νοε 2023 · JFrame (String title, Rectangle bounds) This constructor creates a JFrame with the specified title and bounds. Methods of Java JFrame. Methods. Description. setTitle (String title) Sets the title of the JFrame. setSize (int width, int height) Sets the size of the JFrame.
8 Ιουλ 2020 · Here's the complete source code for a Java class named SimpleJFrameDemo, that demonstrates how to construct and display a Java frame (a JFrame): import java.awt.Dimension; import javax.swing.JFrame; import javax.swing.SwingUtilities; /**. * A sample class that demonstrates how to create and display a JFrame. *.
27 Απρ 2022 · The add method adds new components to our frame. We now extend the above example: Now our example window contains a JLabel component (label). As you can see, here we just added an import statement for our JLabel and called the add method, in which we passed an object of the JLabel class as a parameter.
3 Απρ 2024 · 1) A simple Java JFrame example. To that end, here is the source code for a simple "JFrame example" demo class. This example shows how to construct a JFrame, and make sure it's properly displayed using the SwingUtilities invokeLater method: import java.awt.*; import javax.swing.*;
6 Ιουλ 2019 · A frame is a base window on which other components rely, such as menu bar, panels, labels, text fields, buttons, etc. Almost every Swing application starts with JFrame window. This article provides a summary of common practices when using JFrame in Swing development. 1. Creating a JFrame window.