Click here to Skip to main content
15,887,856 members
Everything / Desktop Programming / Swing

Swing

Swing

Great Reads

by Shubhashish_Mandal
Animated sliding panel in Swing.
by Santhosh Kumar Jayaraman
How to create a simple IMEI validator application using Java Swing
by csanuragjain
Captures, searches, and manages all your screenshots in one place.
by Osmund Francis
Creating templates in Eclipse to generate Java EventQueue statements

Latest Articles

by Michael B Pliam
A recursive descent math expression parser with built-in functions and a variable mapping
by Tung.Nguyen.2k
How to implement B-Tree's searching, insertion and deletion in Java
by AmosShi
Watch the Java class file visually & interactively for the meaning of every byte
by Ngo Tuong Dan
A usecase for Java beginner

All Articles

Sort by Updated

Swing 

27 Aug 2014 by .eclipseWarrior
I searched a lot on google on this subject, but just can't come out with right solution.Part of my code with JLabels created:frame = new JFrame(); frame.setTitle("New family tree"); ... JPanel panel = new JPanel(); panel.setBackground(new Color(30, 144,...
10 Sep 2011 by Aash Maharoon
Hi,,,I am new to BeansBinding. I want to know how to do that in Netbeans IDE for swing application development as it supports for auto code generating.I followed java.net's Beansbinding project.but it was hard to understand there.Also Netbeans beanbinding tutorial.But it is not a complete...
24 Sep 2011 by aashu45
how can i arrange buttons for making onscreen keyboard using java swing?
21 Sep 2012 by Abhishek Nandgaonkar
My application has two parts; a server and multiple clients. This project has its implementation both on Windows(Swing) and Android.The Server sends a song which a client receives and starts playing; more like we watch videos on YouTube; streaming.Sending data in chunks and receiving the...
7 Dec 2009 by Abhishek Sur
Reminds me a popular movie... :laugh: Missing links in what? Are you talking about web links ? or you are talking about Unc address ?If it is accessible using Unc path, connect to a service (say ping service) and try to get the response.If you are talking about http path, you are...
3 Apr 2009 by Akshay Bapat
Did it for the sake of a mini-project... Watch out for my real project...
15 Mar 2014 by Alain Peralta
How to use getMagicCaretPosition without getting null value
3 Feb 2004 by alfreds
A near to perfect clone of the very popular Yahoo messenger. Purely written in Java and SWING, this messenger also uses the capabilities of JNI and JAWT to provide some features.
6 May 2021 by Allan Nanks
i am working on a standalone core java project using graphical user interace. i have created buttons to show days of the week from sunday to saturday. now the problem is that i want to create buttons such that when the user clicks on a day, they...
6 Dec 2009 by ammu23
Hi, My project name is "A framework for discovering missing links in the Internet Topology" please explain this concept clearly i can't get it.
6 Dec 2009 by ammu23
Hi, Please Explain about CONVERSION OF INTERNETPROTOCOL TO AUTONOMOUS SYSTEM
22 Nov 2010 by ammu23
import java.awt.*;import java.awt.event.*;import javax.swing.*;class Awt implements ActionListener{ JFrame f; JButton b1,b2,b3,b4,b5; JTextField t1,t2,t3; JLabel l,l1; Awt() { f=new JFrame("Listener"); t1=new JTextField(" "); t2=new JTextField(" ...
21 Jun 2016 by AmosShi
Watch the Java class file visually & interactively for the meaning of every byte
26 Apr 2015 by anand vemuri
try herehttps://jqueryui.com/autocomplete/#combobox[^]
15 Jun 2011 by ankit_khedekar
i'm creeting a tree view for the file system....in order to assgin different icons to each node i'm overriding getTreeCellRendererComponent in the following mannerpublic Component getTreeCellRendererComponent(JTree tree, Object value,boolean sel, boolean expanded, boolean leaf, int...
16 Jun 2011 by ankit_khedekar
dont know how but this solved my problempublic Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { System.out.println("value is :"+value.getClass()); ...
1 Mar 2010 by Arun Reginald Zaheeruddin
A step-by-step guide taking a beginners' approach at effectively creating UI components in Java. This tutorial takes you through the initialization to the completion of an aesthetically pleasing UI component in Java.
3 Mar 2010 by Arun Reginald Zaheeruddin
Put your javax.swing.JPanel on a javax.swing.JScrollPane like this:JPanel pnlImage = new JPanel(new BorderLayout());JScrollPane spnImage = new JScrollPane(pnlImage);Then instead of placing the panel pnlImage on your container or frame, place the scroll pane spnImage on it.
31 Mar 2022 by ASH 2022
I created a program to drag & drop images, and I want to make the image black & white after right-clicking. What I have tried: What I did is to make the image black & white directly after dnd but what I want to do is to make the right-click...
5 Sep 2012 by Ashraff Ali Wahab
Check whether the below code is what you need or let me know if your requirement is different.import java.awt.Dimension;import javax.swing.JFrame;import javax.swing.JPanel;import javax.swing.JScrollPane;import javax.swing.JTextArea;import javax.swing.SwingUtilities;import...
10 Sep 2012 by Ashraff Ali Wahab
48 Bit Image Processing using JAI(Java Advanced Imaging Library)
2 Dec 2009 by AspDotNetDev
Well, the URL has a semicolon where it should have a colon. That could be a problem.http;//Should be.http://Also, the web services I work with typically have an extension in the URL, but that could just be because I work with Microsoft technologies. For example:NWSSService?wsdlWould...
28 Feb 2010 by AspDotNetDev
SHREEKANTH P wrote:is this a good projectYep.
27 Aug 2018 by Astronomize
package graphq.gui; import java.awt.AlphaComposite; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import...
15 Jan 2023 by Aura Blue
So, I have a program project in mind where the user enters some specifications, java stores the input as variable and by using an if else statement displays the result accordingly. The program is about finding your anime girl. I need some tips on...
10 Oct 2010 by b4rc0ll0
Reusable extension of JPanel with rounded borders, shadow and antialiasing
7 Oct 2010 by b4rc0ll0
Create a useful draggable generic component to create custom graphic desktop applications, like visual editors or multimedia management
11 Oct 2010 by b4rc0ll0
Create a Shape for a custom JFrame and apply a transparency effect (0 to 1 alpha value) on entire window, on Windows Platform
8 Nov 2010 by b4rc0ll0
Create a smart Java component used as accordion menu. Explains how to create visual transition effects, and simple icons management. Also shows how to create a hierarchy of components with an easy cascade management.
15 Jan 2014 by baliram bhande
i am work on swing related project in that one main frame is there when i run project in that first mainframe1 is visible after when i perform other action event another frame2 is visible but problem is that when i close latest frame(means frame 2 ) at that time hole program is close i.e closes...
4 Mar 2014 by baliram bhande
i am working on swing related project in that i am increase text Field dynamically but i am not able to give unique name to each text field .please give me suggestion how can i use each text Field .getText(); method for text Field or how we can give unique name to the each text fieldmy code...
19 Mar 2014 by baliram bhande
i working on JTable in that i am increasing rows dynamically in that all column are textbox but i want to add button in any one column for edit and delete purpose how can i add button in tahtmy code is bellow row[0] = res.getString(1); row[1] = res.getString(2); row[2] =...
21 Mar 2014 by baliram bhande
i am getting value from table column at that time i want to convert that value into float value Object s=table.getModel().getValueAt(i, 3); Object s1=table.getModel().getValueAt(i, 5);int j = Integer.valueOf((String) s); int j1 = Integer.valueOf((String) s1);how can i...
22 Mar 2014 by baliram bhande
String str = (String) table.getModel().getValueAt(i, 3); String str1 = (String) table.getModel().getValueAt(i, 5);System.out.println("object is " + Float.valueOf(str)); System.out.println("object is1 " + Float.valueOf(str1)); Float...
26 Mar 2014 by baliram bhande
i create JTable in that table value are retrieve from data base (Except fifth column) in fifth column .i enter value through keyboard in fifth column but when getting value again from jtable at that time i am not getting last entered value in fifth column please suggest something my method...
27 Mar 2014 by baliram bhande
after ony day i have got this solutionpublic class TableDataDelete implements ActionListener { public void actionPerformed(ActionEvent ee) { int count=0; // int a = table.getColumnCount(); if(table.getCellEditor() != null) ...
5 Apr 2021 by Basmala Haggag
I am making a game using java. At the beginning of my game there is a panel with a welcome message and then by pressing start you can go to the first level in the game. My question is how to switch panels(to go from the welcome message to level...
18 Apr 2021 by Basmala Haggag
My problem is when I run this code it should normally pop up a window, but that's not the case. can anyone help me with that please. Thank you! What I have tried: import java.awt.FlowLayout; import java.awt.event.ActionEvent; import...
14 Apr 2014 by BBSid
**Getting data on from rfid scanner as Serial rs232 port in JFrame**, in this case I have made a JFrame form and I have a JTextField for storing data rfid as a String. Actually, I found a class from internet that read the RFID reader as byte, now How To get data from my RFID Class to my...
16 Jul 2016 by Beginner Luck
JButton button1 = new JButton("new button");button1 .setActinCommand(idActin );button1 .setActionListener(this); ...void actionPerformed(ActionEvent e) { String idActin = e.getActionCommand();}Try this
4 May 2014 by bemlicious
Currently, I have a code that retrieves an employee's ID,firstName,lastName and position. These pieces of Information are then inserted to a jtable with checkboxes.Then check if the employee is present or not. Then there is a save button that when clicked, the attedance is saved into a new...
2 Jun 2012 by Ben Baron
Java source code to demonstrate Executable Integration which is a concept of integrating several distinct executables to create a single application
26 Jun 2010 by bensalah
hi every one,i dont find simple drawing java app with (cut,copy,past,undo,redo)featurescan someone give me an exemple of source codethank you very much
6 Jul 2017 by Bilal Zafar
Hello all, I am very new to java, so please ignore if you think this question is stupid. A task has been assigned to me in which I have to extract data from h2 database table with **more than 1 crore rows (SAD) from one table.** And finally show that data into a j table with pagination. What i...
17 Dec 2012 by Chiranthaka Sampath
1.) I have created an abstract class as the following. All the methods that belongs to the class is also added as at the following. public abstract class Vehicles { public String vRegNo; public String vModel; public String vBrand; public boolean hired; // This hired...
23 Dec 2012 by Chiranthaka Sampath
When I am using JInternalFrame where and how am I able to connect a MS Access database using a separate class? I already create a class as the following.import java.sql.*;import javax.swing.*;public class Connect {Connection conn = null;ResultSet rs = null;PreparedStatement pst...
13 Jan 2013 by Chiranthaka Sampath
I want to find one record that exists on a mysql database table using the following statement. The filteration is done using a textfiled. I am using Java & i don't use the JPA. Just simple mysql database connection with mysql connector.At the below I have pasted the whole java application....
27 Jun 2013 by Chiranthaka Sampath
I have created the following JPanel and I want to display that JPanel within a JFrame form. JPanel import javax.swing.*;public class JPanelFormInJFrameForm extends JPanel{ /** * @param args the command line arguments */ public...
30 Jun 2013 by Chiranthaka Sampath
Could someone give me some advice on building an swing app that like a Digital calculator that will have one textfield and many buttons to input the digits, mathematical operators and the decimal symbol. Because I have searched through the internet and there are plenty of source codes but they...
6 Dec 2017 by Chiranthaka Sampath
I have created 3 classes. 1st class is used to store variable. other classes are use to input data and to display data. 1st Class public class Student { /** * @param args the command line arguments */ private String strStudNo; private String...
4 Jul 2013 by Chiranthaka Sampath
I have solved my problem by using the static keyword. I changed all the variables in the Student class from non-static to static content and also I changed all the getter () and setter () from non-static to static content. Then the access of the variables and other methods are as the...
7 Jul 2013 by Chiranthaka Sampath
I have created a Java Swing application using MySQL and JPA. I was able to add the data from a JFrame form. The following DBM class will use to manage the DB connectivity using JPA. The entity for the Database Table is as Employee. public class DBM { private...
3 Jan 2018 by Chiranthaka Sampath
Hi guys, I have a small question. I have developed a JFrame Form from scratch using Java SWING package. The appearance is ok. I have not used a layout manager so that I have manually given the locations & the dimensions. It also connect to a MySQL database and there aren't any issues...
24 May 2012 by codeBegin
check some links:http://stackoverflow.com/questions/7175990/java-chatserver-with-gui[^]http://www.roseindia.net/chatserver/[^]http://ruchirac.blogspot.in/2009/09/create-chat-server-in-java-rpc.html[^]http://www.indiastudychannel.com/projects/1233-Chat-application-JAVA.aspx[^]
11 Jul 2014 by Coder93
I want to implement java desktop application, which show a user location.how can I load a map in java window. (suppose that I have the latitude and longitude)I find...
21 Jul 2014 by Coder93
I need a layout in java which contains only one column and number of rows are increasing during my app! (something like flowlayout but in vertical mode!)I find : panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));but I want each row component has its minimum size (which its content...
17 Jun 2013 by Conorthecoder43
just need this code looking over and making sure it is okay really, some of it doesn't work! Any help?Module Module1 Sub Main() Dim MenuOption, MonthChoice, SurnameChoice, textstring As String Dim setflag As Boolean 'setflag will be false until a match is...
15 Nov 2017 by CPallini
Your code is almost correct. Try class SequentialNumber { private static int currentNumber = 3000; public static String GetNextNumber() { currentNumber++; return "B"+currentNumber; } } public class program { public static void main(String args[]) { for (int n=0; n
2 Jan 2018 by CPallini
Did you try Google, didn't you? See, for instance: How Do I Convert My Programs to Swing?[^].
2 Feb 2018 by CPallini
I guess you have to complete the actionPerformed method public void actionPerformed(ActionEvent e){ // do useful stuff here //.. } //
7 Jun 2013 by csanuragjain
Captures, searches, and manages all your screenshots in one place.
22 Jul 2010 by Dalek Dave
Not if you want to take on the challenge :)
18 Dec 2014 by DamithSL
check below similar questions and the answers:How do I get the size of a java.sql.ResultSet?[^]How to get row count using ResultSet in Java?[^]
15 Aug 2015 by DamithSL
I don't think there is a converter or import mechanism available from swing to android, you may reuse the class files but you have to create UI again in android
15 May 2022 by daniel wakeley
So I'm making a festival scheduling app that takes user input from a Swing GUI and then schedules all the songs according to time and priority. I'm just wondering do I store the input in multiple Variables or an array. Also, after that how do...
5 Mar 2020 by Darwin Ramos
I am currently designing my System. I added a cell renderer in order to create an alternate row color on my Jtable but when I insert cell renderer in my code, JTabel selection becomes cell unlike when before I insert the code where the selection...
25 Mar 2014 by debasish deb
I m developing a calculator (for NIT Student) in Java. I'm using netbeans 7.1.2 software.In drag and drop for testing I drag and drop two JtextField , In one JTextField i will enter my marks (for Example 7.64). Now in another JTextField (Grade for example B) should display (and it...
27 Dec 2017 by developer067
So i made a method in my java program, that I want to use to be able to draw a circle. I then want to add that circle to a panel in my code. What's the issue with the following? public void circle(Graphics g, int xLocation, int yLocation, int width, int height) { //Graphics g; ...
6 Dec 2017 by dolfijn3000
so i'm learning java and i was trying to make a button. the problem is that whenever i create a button it is as big as the screen. can someone fix this please ? Main.java: package com.softbite.library.TextBasedGame; import javax.swing.JFrame; public class Frame { // method to create a...
3 Dec 2015 by Dr Neelendra Badal, Prince Verma, Amit Patel, Satakshi Gupta
It is a tool to extract desired information from Pdf documents, we have developed it in context of extracting information of an individual from E-Aadhar (it is a unique identity issued by Govt. of India). User can modify the code according to desired Pdf documents.
27 Oct 2012 by dsagner
Hi everyone, I've got a small (I hope) yet interesting problem. I have got an assignment today at my university which causes me a headache by now. The job is to design a swing app which uses reflection to create an instance of a class called "Pravokutnik" (never mind the class name) which is a...
4 Sep 2014 by Emiliarge
A JavaFX/Swing NetBeans 8.0 Project with JFrame created by NetBeans's GUI Builder
28 Jan 2009 by Eric Beijer
A simulation of Minesweeper by Microsoft with improvement, I think
18 Apr 2012 by Eric Beijer
A Sudoku game written in Java which generates its own games on the fly.
31 May 2021 by Farooq Ali 2021
I have been making this project without drag and drop in Java Swing and I have been encountered with an issue where the panel behind my shown panel in card layout do not disposes, i.e : my panel is transparent , so the panel behind it is also...
18 Oct 2010 by faseem
I made a JFrame parent and Jdialog child. But I am not able to access the modified value of the variableof parent from the child class. code:import [swing packages needed];public class grading extends JFrame implements ActionListener{ public int me=4; //this one JTextField...
19 Aug 2018 by FerdouZ
I already done a socket program where multiple client send data to server1 and server1 forward the data to server2. Now I want to do this program with Swing GUI. Can anyone help me how to create it? I submit my code below == What I have tried: Client import java.net.*; import java.io.*; ...
8 May 2013 by Filipe Marques
Hi Kapilk,Just use an array. You read the number of of columns from the combobox and then create an array of JCheckBox:int numberCheckBox = ...JCheckBox[] checkBoxList = new JCheckBox[numberCheckBox];for(int i = 0; i
5 Mar 2020 by fMuwouJjdjdoue
In the below program I am just trying to move the box on the screen based on the key pressed.I have to clear the last position of the box and draw its new position .When flag is true I will clear the screen and when the flag is false I will draw...
15 Aug 2012 by FoxRoot
Hello everyone,I want to set a label with the image which user select via filechooser. Is there any way to do this? Here is my Browse button code;I want this; When I double click the image the it should go to the label.:(name is LabelPicture)int returnValue =...
15 Aug 2012 by FoxRoot
int returnValue = jFileChooser1.showOpenDialog(this);//Crate a filechoser jFileChooser1.setVisible(true);//SetVisible if (returnValue == JFileChooser.APPROVE_OPTION) { File file = jFileChooser1.getSelectedFile();//Get the file ImageIcon icon =...
8 Feb 2013 by Fredrik Bornander
That is because in BufferedImages with a ColorModel the pixel is set to the nearest colour chosen. That means that you might not get the colour you wanted because the colours you can set are limited to the colours in the ColorModel.You can get around that by creating your own BufferedImage...
24 Oct 2022 by FreedMalloc
Your code has 2 main methods, one in LoginFrame and one in FileSelector. A program should have only one main method. You need to rethink your logic. What I believe you might want is some sort of controller class that has the one and only main...
20 Dec 2022 by gamedevgod
i am maeing a game and i am puting all of the stuff on a JLayeredPane but it is not showing hear is my code: import java.awt.Color; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import...
28 Dec 2016 by GaneshRfromSpace
This is my xml file which contains Tamil language scripts. வீடு I am using DOM parser to parse the xml file. ...
6 Aug 2013 by Georges23
Good day After a lot of effort and experiments with the goal of properly implementing mvc in a swing application. I am still unable to build an Mvc swing java application.Please Find source code below.This is The Model/** * @author soffo * */public class RentalModel...
6 Aug 2013 by Georges23
Hello can anyone please tell me where i can find an open source dashboard designer for java swing applications. Thanks in advance.
4 Apr 2020 by Gerry Schmitz
During each frame, move each circle, then loop through each circle, calling a method on the circle, called "IsInContact" and does whatever it needs to detect "contact". "Collision" implies an event, whereas "in contact" is a state, which is more...
5 Apr 2021 by Gerry Schmitz
Create a "wizard". Creating Wizard Dialogs with Java Swing[^]
27 Jan 2014 by Gigabyte Giant
A couple changes I recommend you make, that might help, are to not use Calendar, it requires to much unnecessary work. As:Calendar stop = Calendar.getInstance();Calendar start = Calendar.getInstance();long lstart = start.getTimeInMillis();long lstop = stop.getTimeInMillis();int istart...
26 Apr 2011 by Guts_ryo
hi everyone.i have a problem pertaining to text box that do not accept any characters. Here is the situation, i have a text box that do not accept any characters, i have an onkeyReleased event that whenever i press any key in keyboard, it says, "Ooops..,this text box do not accept any...
5 Feb 2009 by Han Bo Sun
An article on how to create a simple web service using JBossWS, how to deploy and test
30 Oct 2015 by hansoctantan
I have an Imageviewer and created an event which detects mouse wheel to zoom image. I want to execute this when Control Key is pressed (Ctrl + Mouse up) or (Ctrl + Mouse down).I use Java Swing. Imageviewer is a panel inside a Toolbox and a ScrollPane with Label containing the image.Thank...
9 Jul 2011 by harsh25 shah
hi... how can i set image as background image in jframe using swing ????