Click here to Skip to main content
15,887,746 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 Title

Swing 

13 Jan 2016 by sibyEntero
I am developing a Java application in Swing.My application needs the win32com.dll (Java Communication API) and the file javax.comm.properties.Normally, I just copy the dll to C:\Java\jre1.6\bin and the config file to C:\Java\jre1.6\lib.The Code I written was...
13 Jan 2016 by Richard MacCutchan
The message:Exception in thread "main" java.lang.UnsatisfiedLinkError: no win32com.dll in java.library.pathis quite clear. The loader cannot find the dll anywhere.
6 Dec 2009 by ammu23
Hi, Please Explain about CONVERSION OF INTERNETPROTOCOL TO AUTONOMOUS SYSTEM
7 Dec 2009 by Rajesh R Subramanian
wrote:Please Explain about CONVERSION OF INTERNETPROTOCOL TO AUTONOMOUS SYSTEMWhat could that possibly mean? Please read How to ask questions the smart way[^][Answered mainly to take this out of the unanswered queries list]
6 Jan 2010 by mpsmoorthy
Read this IEEE/ACM Transactions on Networking (TON)http://portal.acm.org/citation.cfm?id=1552193.1552196
10 Jul 2011 by Ravimal Bandara
An efficient algorithm for encode 7-bit characters to 6 or 5 bits to reduce the size of a string
6 Dec 2013 by rajahari kannan
Hi guys,Nested GridView [No JavaScripts][^]I am a newbie to java and swings. I wanted to develop the same in the link provided above with java jtables. I am not able to figure it out and if possible can any help me out giving a sample code.i tried only populating a table and with the...
6 Dec 2013 by TorstenH.
That is possible by add a Panel / some component as cell content containing another Table.I have also often seen a Jpanel with a GridLayout in the cell, which makes it easier to handle.You will need a customCellRenderer though to make it run.How to use Tables[^] @ the Java tutorials
21 Apr 2013 by Jyothi Bhat
hi...i am new to java...now i need to design 1 frame with 2 vertical frames,in the first frame i should put 1 label followed by drop down list..next again a label with text boxwhere user can enter text.in the 2nd frame i should import files from a folder and select...there should be...
22 Apr 2013 by nameJulian
Well i can't give you a full advice on how to work with your files, but as for the 2 vertical frame, i would rather use one frame. I would create a panel in it. To this panel i would give a GridLayout(1,2) (1 row, 2 columns ) and then add two more panels ( internal panels if your prefer...
27 Feb 2010 by SHREEKANTH P
hi i am doing project about adaptive image segmentation and image processing is this a good project....... i am using java language
28 Feb 2010 by AspDotNetDev
SHREEKANTH P wrote:is this a good projectYep.
12 Sep 2013 by Shubhashish_Mandal
Add Save functionality in ReportCat, a Java print library.
3 Jun 2017 by Mat3
How to populate jList by the keys from Map collection? I have added jListCars to a jScrollPanel and now I want to populate jListCars by key Strings from Map. So far I have used demoList that is added to jListCars. However I will need often to add new vehicles and I dont want each time to be...
19 Feb 2009 by logicchild
An article to launch the beginner into the world of Java GUI programming
11 Mar 2009 by logicchild
An article for the student of Java GUI programming.
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
2 Dec 2016 by Tung.Nguyen.2k
How to implement B-Tree's searching, insertion and deletion in Java
21 Apr 2011 by Penkov Vladimir
Shows how to use beans binding with swinghtmltemplate
10 Feb 2014 by Summeronthebeach
I know the below code is supposed to format the FormattedTextField but it doesn't seem to do anything to the form (shown in the picture below). I was wanting, when the form loaded: the text field to look something like this00/00/2014 - 00:00 amWhere the user is able to- enter...
8 Feb 2013 by manuthebos
which is best suitable image format for pixel level calculation {eg: getpixel,setpixel} . i want hide some data in image pixel. which format i prefer ? jpg or png,gif ,bmp or etc...?
9 Feb 2013 by Mehdi Gholam
To hide data in an image you need the compresion on the image to be lossless so you should use : PNG, GIF, BMP etc.
6 Aug 2009 by Piyushkp
http://www.cs.ucsb.edu/~ebelding/txt/infocom06.pdf
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(" ...
20 Nov 2010 by Richard MacCutchan
The strings returned by getText() contain trailing spaces which parseInt() objects to. Change your code to something like:String stemp = t1.getText().trim();int a=Integer.parseInt(stemp);
4 May 2013 by nameJulian
As a minor advice. Why have you initialized your text fields with so many space characters? If you want the text fields to be empty, the just initialize them like this: JTextField myTextField=new JTextField("");Thus the compiler knows that text fields must be empty. And by...
13 Jan 2021 by Member 11296776
I have the following example code Public class A extends JFrame{ public A() { setSIze(500,500); } } Public class B extends A{ public B() { setSIze(200,200); } } If i instantiate B it will first call A So it will setSize(500,500) Then it will...
13 Jan 2021 by OriginalGriff
No. A class that extends a base class includes everything from the base as well as adding the new features - so the constructor of the base class is always automatically called before the constructor for the derived class, or the derived class...
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.*; ...
19 Aug 2018 by Richard MacCutchan
See Trail: Creating a GUI With JFC/Swing (The Java™ Tutorials)[^].
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...
4 May 2014 by TorstenH.
That is a classic homework task - please provide code.I'd go with the comment of wilkus70. you're saving the attendance each time with a save-button to the DB.So you should make an request to receive all entries which have the empID you are requesting it for.so that would be SELECT...
26 May 2012 by kushal.choudhary
can chat On a single computer with chat server.........m i chat with two users in one computer
26 May 2012 by PrafullaVedante
YES. its always possible to have a server and multiple clients to that server on same machine if they are communicating through sockets.
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...
29 May 2021 by Rahul Negi 2021
Object class present in java.lang.package. java.lang.package imported by default in java. Object class contains Event handling classes and awt. So why we need to import java.awt when we use awt in java...since it should be in lang.package which...
29 May 2021 by Richard MacCutchan
Quote: Object class contains Event handling classes and awt. No, object is the base of all classes and contains almost nothing. See java.awt Class Hierarchy (Java Platform SE 7 )[^].
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...
3 Jan 2018 by wseng
Use this jFirstForm.getContentPane().setBackground(Color.BLUE);
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...
19 Jan 2014 by TorstenH.
Split application runtime and JFrame. The JFrame is NOT the application! functional code should not be located in a JFrame.And yes, I second Richard, please show code.
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...
23 Dec 2012 by TorstenH.
NO.That's the constructor. That one is by definition not supposed to execute code.public class ItemDetails extends JInternalFrame{ private Connection oConnection = null; public ItemDetails(){ } private Connection getDBConnection(){ if(null ==...
26 Mar 2014 by Lộc Nguyễn
Example of JNotif - A Java Notification App
3 Apr 2009 by tduffy
Create a Swing dialog for choosing fonts.
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 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...
30 Jun 2013 by Richard MacCutchan
See http://docs.oracle.com/javase/tutorial/index.html[^].
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...
11 Dec 2012 by TorstenH.
You need a class above the Vehicles - some VehicleFacade:public calls VehicleFacade {Vector vehicles = new Vector(); public VehicleFacade(){ /* doany(); */} public void addVehicle(Vehicle vehicle){ if(this.validateVehicle(vehicle)){ ...
11 Dec 2012 by TorstenH.
Simple Solution:Your main method, which is the entry point for your app, needs to move out of the class van:public class VehicleManagement(){ public VehicleManagement(){ this.ignition(); } private void ignition(){ // code of former main goes here } public...
19 Dec 2012 by TorstenH.
OK, it's Christmas time - so here we go with the complete solution:1. Take your current classes "Vehicle" and "Van" - those are looking quite fine now.the new constructors are good (beside of that you missed the "int intWheels" to be set in "Van", but that does not harm the app until it is...
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
3 Aug 2010 by Jarno Burger
its more a design pattern that you have to use :design patterns are a way of writing code that lets you do abstract (fluffy) things that also restrict you writing easily maintainable code.check memento and command pattern...check this website for the basics...
17 Apr 2009 by Matt Stine
Deploying Grails with Groovy
12 Apr 2014 by HuggableAlien
Hello, I am making a Windows 8 style Nimbus skin for my Java application, and this involved customizing the title bar's buttons, such as using windows 8 X buttons etc. My issue is that in Windows 8, the maximize and minimize buttons are the same color as the title bar, this is fine when the...
10 Aug 2014 by Uganraj
i have small problem while disabling/enabling buttons in Swing Application. It's very basic problem, but I'm new to this concept.I have a requirement like, having 2 buttons to perform 2 individual operations.1)While Running initially B1 & B2 Should be Visible/Enabled.2)If B1 Clicked,...
10 Aug 2014 by TorstenH.
I updated the markup.You are using: primaryButton.setVisible(true);to make the buttons working/not working. That is not good practice, cause the user is going to miss the controlls - and the dynamic change in your UI will probably easily mess up everything.Please use ...
18 Nov 2013 by Victor Edet
Hello I have been struggling for days now trying to figure out how I can display an image on a jLabel from a blob column in oracle database but all efforts seems not sufficient to produce desired results. The problem is that the Label displays a dark colour stuff like background. I've spent so...
27 Jun 2013 by Shubhashish_Mandal
You did everything but forget to display the frame.frame.setVisible(true);And the line should come at the end.
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...
27 Jun 2013 by TorstenH.
- Do NOT work in main- Do NOT use keywords like "Frame" for variables.- Do NOT start variable names with upper case - uppercase is an objects name, never a variable.Please bookmark this link: http://docs.oracle.com/javase/tutorial/uiswing/components/frame.html[^]public class MyForm...
29 May 2021 by Rahul Negi 2021
i am learning awt and i am confused in java hierarchy. So since java.lang imported by default and it contains Object class. Object class is base class to all class. So when lang package is imported by default, will all the derived class of...
29 May 2021 by OriginalGriff
No. Objects know about things they are derived from, all the way back to object - but no class should know about anything that is derived from it. So if ClassA derives from ClassB, and ClassC derives from ClassA, then: ClassC can use anything in...
29 May 2021 by Richard MacCutchan
Why have you reposted this question? I gave you a link to the answer yesterday at Can you explain package hierachy in java.[^]. I suggest that before you try to learn awt you spend time learning Java and the inheritance rules, starting with...
7 Oct 2010 by b4rc0ll0
Create a useful draggable generic component to create custom graphic desktop applications, like visual editors or multimedia management
7 Dec 2022 by pitwi
Hi! A view weeks ago I changed from Visual Studio C# to Java and now I've tried my first project with Swing and WindowBuilder. So far so good and everything works fine - except drawing that line. There's no error message but also no line. Neither...
7 Dec 2022 by Richard MacCutchan
See Line2D Java Example - Computer Notes[^]
24 Nov 2010 by Penkov Vladimir
Shows how to manage swing components in HTML style
24 Jul 2014 by Osmund Francis
Creating templates in Eclipse to generate Java EventQueue statements
2 Sep 2014 by kjburns1980
This tip provides code for an enhanced version of the JTabbedPane which allows the developer to add toolbar buttons to the beginning or end of the tab set.
7 Dec 2009 by ozmrdn
hi,I was creating a WS client server that is not running.I'm using Glassfish v2.1 and Netbeans 6.5.I received an error as follows:"Problem with downloading WSDL or Schema file. Check url, proxy settings or whether server is running. URL:...
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...
7 Dec 2009 by Sriram K G
Check if you could connect to the web serivce URL via browser.
27 Oct 2010 by TonDRG
use crisc.ru for certification in CRISC ISACA
14 Dec 2012 by neldesai
I am try to build a client server chat application using swing.In that when i start client i send a message that i can received at client site but when i press a button on Server site it will not open up a new Frame (that is in my case error here).How can i solve it...And can any one suggest...
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
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....
8 Jan 2013 by Shubhashish_Mandal
String item = txtICode.getText();To Delete :sql = "DELETE FROM ITEMDETAILS WHERE ItemCode = '"+item+"'";To Retrivesql = "SELECT * FROM ITEMDETAILS WHERE ItemCode = '"+item+"'";
13 Apr 2013 by Khaled Mohamed El Sawy
Before i ask this question i have been working to find the conversions from swing and AWT in java to android I made an application about remote access that works fine on the computer and while rewriting it on the ADT i figured out some problems in my code that uses the java GUI like swing and...
16 Jul 2016 by renderNN
I have JFrame Main which contains in left side JXTaskPainContainer (content menu) and right side cardLayout panel. Content menu has a JButton btn("data"), when we click btn it shows on cardLayout panel -> JPanel Test. Under content menu there is addButton, which adds dynamic btn -> "data2",...
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
7 Feb 2013 by manuthebos
BufferedImage bimg = ImageIO.read(fc.getSelectedFile()); bimg.setRGB(0, 0, 1234); int x = bimg.getRGB(0,0);in the above code i didn't get x as 1234 why ?
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...
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...
26 Mar 2014 by Xiao Ling
if you use ((DefaultTableModel)table.getModel()).removeRow(i);, the total row count will be changed. so you have to modify the count value:int b = table.getRowCount(); System.out.println("row count" + b); for (int i = 0; i
27 Mar 2014 by TorstenH.
Please read here: http://docs.oracle.com/javase/tutorial/uiswing/components/table.html[^]it describes all your tasks in this run.Have fun!
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) ...
26 Apr 2009 by Vitaly Shelest
Demonstrates a simple technique for embedding WPF/.NET Components into Java GUI
8 Dec 2015 by Member 12193581
import javax.swing.ImageIcon;import javax.swing.JPanel;public class Draw extends JPanel{ private static final long serialVersionUID = 1L; String s; int x,y,height,width; public...
24 Sep 2011 by aashu45
how can i arrange buttons for making onscreen keyboard using java swing?
25 Sep 2011 by Richard MacCutchan
This trail[^] should help you.
25 Sep 2011 by TorstenH.
Your Application needs a layout.Check this: http://download.oracle.com/javase/tutorial/uiswing/layout/visual.html[^]Also please consider to use the default-windows keyboard. Windows comes with an on screen keyboard. You can call it by passing the program's name "osk.exe" to the OS.
15 Aug 2015 by Member 11912019
I have developed a Desktop game using java swing.Now I want to launch it for android players .How can I do that.
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
18 Feb 2016 by Member 12335940
I have a sceleton code for creating chart. I draw the frame. You only fulfill this source code.https://gist.github.com/anonymous/ef021bf009b6cc20ab31What I have tried:I couldn't find enough knowledge about AIOTrade and I don't understand how should I use it. Please help. Thaks.