165 Topics
| |
[SIZE=4][FONT=Arial]Hi, I'm creating an application that makes use of the GridBagLayout as it is the most useful layout manager for what I need. I made a JPanel and added it to the frame. The result I'm currently getting during run-time is a JFrame with a JPanel placed in the center. … | |
Hello, I would like to develop a sprite editor. Therefore I have programmed a software like paint. As you can see on the picture, on the right, there is a canvas with a grid on it. I use a GridBagLayout to manage every widgets inside my window. The canvas is … | |
In my Food Tab, I wanted to achieve this [Click Here](https://sfault-image.b0.upaiyun.com/358/064/3580648794-597611aa1f701) But I only able to get this [Click Here](https://sfault-image.b0.upaiyun.com/779/111/779111227-5976120f6955a) How can I increase the width of the JTextField which are in Food Tab ? Below is my code public class FoodOrdering { static private JFrame frame; static private JTextField … | |
Hey new to JDBC SQL DERBY and Java so I don't know why but my Jtable only shows the columns. Here are my codes for my LeaderboardDAO class. public class LeaderboardDAO extends Dao { private static final Logger LOG = LogManager.getLogger(PlayerDAO.class); public static final String TABLE_NAME = "leaderboard"; private static … | |
Flickering occurs when Active Rendering with JPanel, not sure why as I've done this before (couldn't find source code of that project however). Relevant Code: Graphics g = projectDCWindow.getWindowGraphics(); // Gets the Graphics Object from a JFrame g.setColor(Color.BLACK); g.fillRect(0, 0, (int) ProjectDCInfo.getDefaultWindowSize().getWidth(), (int) ProjectDCInfo.getDefaultWindowSize().getHeight()); // Clears the screen projectDCGSM.get().render(g); // … | |
I'm trying to give access to client computer from my server and also tryin to revoke the granted access... the grant is successful but the revoking is not working please help. hms is the satabase that i want to give access to my clients.. my code try { Connection con … | |
Hello, I try to rename file or directory using JFileChooser() and JButton(). But it gives me a NullPointer exeption. I have FileChooser, Button and TextField where I write new name for my file or directory. Can you say where I go wrong and how to solve this problem. // button … | |
I have a JTable that a user can input data. I have an image that I would want to put at the top of my page when printed and also another image that I would want to work as footer. How do I print these on the same page including … | |
Following is my program i need to add scroll to jframe and I have paint method in it package other; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Container; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.ScrollPane; import java.awt.Stroke; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.geom.Line2D; import javax.swing.*; public class MainDrawCycle extends JPanel implements ActionListener { … | |
hello every body. I need a book at java swing package.i am new in java programming and i want to learn GUI so plz help me. i want to download book of herbert schildt. book name swing a beginner guide Author Herbert Schildt | |
Is it possible to call repaint() inside the main()?I have tried the code below.But its not working public mypanel() { initComponents(); repaint(100,150,40,40); } protected void paintComponent(final Graphics g) { final Graphics2D g2 = (Graphics2D)jLabel2.getGraphics(); g2.drawRect(100,150,40,40); } //above code doesnt provide any output private void formMouseClicked(java.awt.event.MouseEvent evt) { repaint(100,150,40,40) } this … | |
Hi, We are facing font issue in our java swing application in linux. Kindly help to solve issue. In our application we are explicity setting font as 'Arial' for labels and others in swing Application. Since Arial is not available in linux so it picks 'Lucida Sans Regular' as default … | |
I'm working on a project on my own and wanted to create an JComponent or JFrame that looks like the following screenshot. ![8557bdcb155e0af7b29ae22b32d6f984](/attachments/small/4/8557bdcb155e0af7b29ae22b32d6f984.JPG "align-left") ![8557bdcb155e0af7b29ae22b32d6f984](/attachments/small/4/8557bdcb155e0af7b29ae22b32d6f984.JPG "align-left") ![8557bdcb155e0af7b29ae22b32d6f984](/attachments/small/4/8557bdcb155e0af7b29ae22b32d6f984.JPG "align-left") ![8557bdcb155e0af7b29ae22b32d6f984](/attachments/small/4/8557bdcb155e0af7b29ae22b32d6f984.JPG "align-left") ![8557bdcb155e0af7b29ae22b32d6f984](/attachments/small/4/8557bdcb155e0af7b29ae22b32d6f984.JPG "align-right") Here is its layout. ![e687f5cd32e6536ff8d0e3406b83b9e2](/attachments/small/4/e687f5cd32e6536ff8d0e3406b83b9e2.png "align-left") ![e687f5cd32e6536ff8d0e3406b83b9e2](/attachments/small/4/e687f5cd32e6536ff8d0e3406b83b9e2.png "align-left") I would appreciate it if you showed me by an … | |
I'm trying to create a JTextPane that has the following properties: 1. Vowel letters are colored in green 2. Consonants are colored in blue 3. Numbers are colored in red 4. And the maximum number of characters is 26 and all characters are in Upper Case To achieve this I … | |
Hi! I'd like to create a simple table game by Swing. I have a JFrame and a JPanel variable. I want to add JButtons to this JPanel, but I'd like to create an own class. I made a class that extends JButton (inheritence): public class GameField extends JButton {...} So … | |
Dear All, In Java Swing, for all components there is a setSize method which takes int height and width as arguments. And we will pass parameters like 600,500 & 400,300 etc... My doubt is what is the unit of these height and width . I mean on what unit, the … | |
hiii.. I got this strange problem.i m refreshing my jframe after every second.This jframe contains a button called addbutton.This addbutton opens another jframe.and that jframe contains a JComboBox .The problem is after every second the JComboBox is getting refreshed.I dont understand why.Before the user gets time to select any item … | |
import java.awt.Point; import javax.swing.*; import java.awt.Graphics; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionAdapter; import javax.swing.JPanel; public class painttest extends JPanel { private int pointCount = 0; private Point[] points = new Point[1000]; public painttest(){ addMouseMotionListener(new MouseMotionAdapter() {public void MouseDragged(MouseEvent event){ if(pointCount<points.length) {points[ pointCount ] = event.getPoint(); // find point ++pointCount; // increment number … | |
import java.awt.Color; import java.awt.event.ItemListener; import java.awt.event.ItemEvent; import javax.swing.*; public class framed implements ItemListener { JToggleButton jtButton; public JPanel createAndShowNewPane() { JPanel GUI= new JPanel(); GUI.setLayout(null); JPanel buttonPane= new JPanel(); buttonPane.setLayout(null); buttonPane.setSize(200,300); buttonPane.setLocation(0,0); GUI.add(buttonPane); jtButton= new JToggleButton("On"); jtButton.setSize(90,50); jtButton.setLocation(100,0); jtButton.addItemListener(this); buttonPane.add(jtButton); return GUI; } public static void window(){ JFrame.setDefaultLookAndFeelDecorated(true); JFrame frame= … | |
Hi All, I have just finished reading fundamental topics in Java and now i have decided to do a New Project in Java which comprises all basic features of Java. I need help in Understanding/visualizing the architecture / Design model for my Project. Specification is : 1 . Develop a … | |
**I want to enter the value in jtable run time and want to dispaly its sum on same jtable when i pressed calculated button ** how to do please help :) import java.awt.BorderLayout; import java.awt.EventQueue; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.sql.*; import java.util.Vector; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.*; import … | |
Hi! Im new to Java and iv been studying GUI's in it. Just started with swing and tried to make this giu for a calcularot. but it doesnt execute and gives me "java.lang.NoClassDefFoundError" error. im a total noob so i cant figure it out. i'd really appreciate it someone could … | |
**Bold Text Here** hey any one can help me sort out my problem.. when i enter the customer id then in tabular format i want its all detail. how to do.. like in textBox i enter customer id as 1 then pressed ok button then in new frame or in … | |
I am using Netbeans 7.1 and MySQL. I need 1 column in jtable which will contain jradiobutton and user can select any 1 row's jradiobutton Please refer the fig for detail. After selecting RB further processing will be done on jbutton click event. ![64496cca6997d07cf995950d67a3e3f0](/attachments/large/2/64496cca6997d07cf995950d67a3e3f0.JPG "64496cca6997d07cf995950d67a3e3f0") Here is the code - … | |
I have one tab by default (tab1) New tabs are generated , equal to 'No of rooms'. The dynamically generated tabs have same structure as of the default tab. I don't know the name of textfields of newly generated tabs. How can I find the name of jtexfields generated on … | |
Hello, I have created a GUI using the Netbeans GUI Builder and I have a JTextArea that I want to output to, but because I need to use threads I am doing a lot of processing in an external thread. I am having issues outputting data from the thread class … | |
Hi, I wonder if anyone can possibly help. I am trying to teach myself how to integrate a Java video into a Java GUI / Swing Application. I am pretty competent with building Java graphical user interfaces and the background Java application code, however I am puzzled with how difficult … | |
I need some help figuring out where I have gone wrong on my program. It is a classic classroom program, where the program creates a random number and gives high, low response untill the user enters the correct number. I have the GUI working and I know the action to … | |
- Please how is possible (probably dirty hack) to create [How to Create Translucent and Shaped Windows](http://docs.oracle.com/javase/tutorial/uiswing/misc/trans_shaped_windows.html) - undecorated container (returns *java.awt.IllegalComponentStateException: The frame is displayable.*) - change Look and Feel for (returns *AWT-EventQueue-0" java.awt.IllegalComponentStateException: The frame is decorated*) - by using code from linked official tutorial . import java.awt.*; … | |
I am making an examination system desktop application in Java Swing. I have a frame named 'show_class_question' frame. This frame is used to display questions and four options from database. Whenever user clicks 'Next' button I am calling this same frame (show_class_question) again and agian from itself (self - refrencing) … |
The End.