3,978 Topics

Member Avatar for
Member Avatar for moonstar3910

[CODE]import javax.swing.*; import javax.swing.border.*; import java.awt.*; public class ConnectFour { // the grid used for storing the game layout. private int[] [] grid; // the player whose turn it is. private int currentPlayer; public ConnectFour () { // create the grid grid = new int [7] [6]; // initialize the …

Member Avatar for roxin_phoenix
0
123
Member Avatar for wallet123

whats the error in here? everytime i run this program even though there are no red underlines and signs still, it say theres an error in here ... and how can i do the same program using if else statement? i have started doing if else but my program its …

Member Avatar for wallet123
0
189
Member Avatar for ajacintha

I have create a JFrame for my Login Screen. I need my JFrame to be Non Draggable. I tried the setUndecorated method. It makes the Jframe Non-Draggable. But I am not able to view the border of the Jframe and also the minimise, close buttons. So what is the alternative …

Member Avatar for ajacintha
0
90
Member Avatar for Armanious

My objective is actually [B]extremely[/B] simple, but I just don't know how to do it. I want to put some swing components on top of graphics which fills the entire screen. That's it. And I can't figure out how to do it... Some other side-questions that I would love to …

Member Avatar for Armanious
0
214
Member Avatar for sirlink99

When I run my code, and advance from level to level it works correctly, but when I would like to restart my program I cannot get the frame to reset. Here is my code [CODE] import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Frame implements KeyListener{ GraphicsDevice vc; Player p …

Member Avatar for sirlink99
0
143
Member Avatar for behemothdave

My assignment is as follows: Create aJApplet that contains twoJTextFields, aJButton, and threeJLabels. When the user types an employee’ s first and last names (separated by a space) in a JTextField, the employee ’ s job title is displayed in a secondJTextField. Include two JLabels to describe theJTextFields used for …

Member Avatar for NormR1
0
520
Member Avatar for vaironl

Hello forum, Vaironl here. I have a small question, I'm making a new screen using the GridBagLayout, since my old screen was using absolute positioning. I'm using a JScrollPane and setting a subPanel in it. THe subPanel contains 40 labels saying Ingredient. For some reasong the Ingredient Scroller will take …

Member Avatar for mKorbel
1
1K
Member Avatar for new_2_java

Hello folks, I am trying to add a JFrame object into JTabbedPane, but I am getting a java.lang.IllegalArgumentException. Here's my code snipt. [code] // other codes... JTabbedPane tabs = new JTabbedPane(); tabs.addTab("Flight Information",flightInfoPane); <-------------- line 28 // other codes... private FlightInfoPane flightInfoPane = new FlightInfoPane(); [/code] Here I have flightInfoPane …

Member Avatar for test.tracker
0
852
Member Avatar for ajacintha

I am new to Java Swing, I have created a JFrame which should get displayed when there is mouse focused over it and should be hidden when the mouse is not over it. Should i add a window listener for it.

Member Avatar for JamesCherrill
0
222
Member Avatar for mohamed moamen

I want to create a JFrame and add panel to it ,the problem in drawing line in this panel [ICODE] package panel; import java.awt.Graphics; import javax.swing.JFrame; import javax.swing.JPanel; public class Main { public static void main(String[] args) { JFrame window = new JFrame(); window.setSize(200, 200); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Graphics g =null ; …

Member Avatar for mohamed moamen
0
1K
Member Avatar for jackmaverick1

When I try to put the JTextArea in a JScrollPane, it a) doesn't display the menu most of the time, and b) doesn't display the scroll bars, even though I've got more text than the size of the JTextArea. Code (it's a VERY simple error console for something else): [CODE]import …

Member Avatar for NormR1
0
163
Member Avatar for scheppy

Hi I have a small problem with with my bubble sort. Everything else in my program works fine if I remove my bubble sort. This is the part of code for the bubble sort. [CODE] //bubble sort based on animal breed if (numberofanimals > 1)//making sure there is more than …

Member Avatar for NormR1
0
228
Member Avatar for Libanesaren

Hello I'm new to Java so all help appreciated I have already searched for similar threads but with no results helping me. I whant to save the data that I input in my Jtable to another Jtable. So the name address etc. that I input in the customer (kundGUI) class …

Member Avatar for mKorbel
0
209
Member Avatar for buchanan23

Hi everyone, I hope you can help me with this. I have everything in my code working properly except for the fact that the payment amounts are being displayed in the command window and I need to display them in the text area, as well as adding scroll bars to …

Member Avatar for buchanan23
0
4K
Member Avatar for J.S.AlKatheeeri

Hi, I'm trying to make a simple calculator. I don't know how to make the display screen and my buttons are not aligned properly. [code]import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.awt.event.*; public class Calculator extends JFrame{ private JButton btn0 , btn1, btn2, btn3, btn4, btn5, btn6, btn7, btn8, btn9, …

Member Avatar for J.S.AlKatheeeri
0
206
Member Avatar for Bladtman242

As part of our exam project we need to write a GUI in java, the problem is that the structure has got us stumped. I'm not asking you to do our work, but if someone could nod us of in the right direction it would really be appreciated. We want …

Member Avatar for Bladtman242
0
204
Member Avatar for Albion1

I have the following code and I want to move from one button to an other depending on the roll of the dice,for example if the dice rolls 5 i want to go to (1+5) six and to put a diferent color to it and so on.Can you help me. …

Member Avatar for NormR1
0
138
Member Avatar for aproxx

Hi everyone! I'm experiencing some trouble with a fairly simple problem I guess. First of all, I'm not a real expert when it comes to java, but I would like to learn it mostly by self study. And I'm sorry for the lots of code, but I can't really specify …

Member Avatar for aproxx
0
154
Member Avatar for kyriacos1986

I am trying to create a countdown timer using the javax.swing.Timer class. In order to display it I am only allowed to use javax.swing.JFrame and javax.swing.TextField classes. Well my Timer works as I expected. But I have trouble when I am trying to display it in the JFrame. It appears …

Member Avatar for JamesCherrill
0
839
Member Avatar for skiabox

I am reading the book Head First Java. Reading the chapter 'networking and threads' I tried to run a project in my Eclipse IDE that consists of a chat server and chat clients. The problem is that I am getting no feedback in the clients text area and debugging seems …

Member Avatar for skiabox
0
354
Member Avatar for xanawa

Hi i am trying to connect with the data base with the following code but it is giving me an error. [B]CODE:[/B] [CODE]/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package dbaccess; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import …

Member Avatar for stephen84s
0
232
Member Avatar for scheppy

I have a extremely small problem, I think its my own fault, but i just cant seem to find what it is. I'm making a program with a gui, and in the gui there is a main menu with 2 JButtons. When I click on a JButton the JPanel/JFrame is …

Member Avatar for scheppy
0
167
Member Avatar for Jenna1994

this is the program i have to write you have to write a program using java language which will realize the following scenario project scenario:when you run your program it will display a welcome messege (you choose ur welcome messege). then program will ask to input a number beetween 1-9999, …

Member Avatar for Philippe.Lahaie
0
196
Member Avatar for scheppy

[CODE] import java.awt.*; import java.awt.event.*; import javax.swing.*; /* *Created by ************ *on Dec 28 *to calculate the area of multiple shapes */ public class AreaCalculator extends JFrame implements ActionListener { static JTextField triwidth, trihieght, recwidth, reclength, cirradius; static Container contentPane; static JPanel infoPane; static double circlearea; static JLabel circleanswer; public …

Member Avatar for scheppy
0
250
Member Avatar for MrBillyUK

Hi all! I am having some trouble displaying the whole of a file within a JTextArea. The problem is that every new line of code that's read is showing within its own JTextArea rather than the text being displayed within a single JTextArea. I assume that the problem is something …

Member Avatar for MrBillyUK
0
148
Member Avatar for 2concussions

hello. i am trying to make a text editor. i can't figure out how to get the file that i select in the JFileChooser to show in the JTextArea. and I also can't figure out how to get the text from the JTextArea to save into a .txt file. [code=java] …

Member Avatar for 2concussions
0
444
Member Avatar for lordsurya08

I'm creating a game in which I draw polygons of varying sizes and shapes using awt/Graphics2D. To smooth out the polygons, I want to use series of cubic Bezier curves to make smoother edges. I spent some time poking around the Java awt and swing classes and saw the Bezier …

Member Avatar for SasseMan
0
473
Member Avatar for Dmiller071

Hi all! I've come very close to finishing this applet of mine but I'm stuck on one last part. The main purpose of this applet is just to fetch some data from a URL (read in 1 line, parse it, and display the data.) After starting this project, I found …

Member Avatar for NormR1
0
315
Member Avatar for abhishek_s_n

Here is a simple code of chat between two peers. According to me, the code does what it should have but I am facing difficulty solving this SocketException error. This code worked fine till i made the last modifications. And now I am finding it difficult to trace the error. …

Member Avatar for abhishek_s_n
0
290
Member Avatar for chamnab
Member Avatar for stultuske
0
74
Member Avatar for Dmiller071

Title says it all. I'm loading my image with the statement below [CODE] //logo = getImage(getDocumentBase(),"http://fromdustelune.com/FD_Logo.png"); logo = getImage(getDocumentBase(),"FD_Logo.png"); [/CODE] *The commented one won't work until I sign this applet (or so I believe that's how it's done* Then I call the paint method: [CODE] public void paint (Graphics g){ …

Member Avatar for NormR1
0
220
Member Avatar for softswing

Hi Friends, How to create properties files for russian launguage in swing application, is ther any code format? kindly help me in this problem.

Member Avatar for stultuske
0
152
Member Avatar for Lunar Savage

Okay, so I've been working on this Inventory Program non-stop all day long. I've made massive changes to it several times and feel like I'm banging my head against the wall. And finally, I managed to make it do everything I need it to do like cycle through an inventory …

Member Avatar for Lunar Savage
0
193
Member Avatar for Dmiller071

My main problem: In my JApplet, my actionPerformed method should open a website when a certain item is selected in a JComboBox. The problem, is that the desktop.browse(uri); statement will not work. I've tried this outside of an applet in just a small program and it ran fine. So there's …

Member Avatar for Dmiller071
0
190
Member Avatar for Skretch

Trying to add a key keylistener to a program i am making but it wont work. cant find the reason :/ any help would be awesome:) Display.class [CODE]package com.mono.main; import java.awt.Graphics; import java.awt.Graphics2D; import javax.swing.JFrame; import javax.swing.JPanel; import com.mono.main.handler.Controller; import com.mono.main.handler.Game; import com.mono.main.handler.InputHandler; public class Display extends JPanel implements Runnable …

Member Avatar for Skretch
0
352
Member Avatar for mynamewontfitin

Hey - Sorry if this is an irritatingly simple problem, but I'm a newbie to the Java language and I can't see where I'm going wrong with this. I get an error with my code when trying to define 'label3' - "cannot find symbol - class Jlabel". It seems to …

Member Avatar for mynamewontfitin
0
2K
Member Avatar for varun45

I am having difficulties with placing images on Buttons using Java Swing. I have placed all images in a package named icon. The frame is loading as well as the buttons. I cant seem to get the images on the buttons. Can anyone point out my mistake please. [CODE]public Launch(){ …

Member Avatar for varun45
0
987
Member Avatar for pushpap7

//create the images folder and past all images into that u want to display... import java.awt.Color; import java.awt.Dimension; import javax.swing.ImageIcon; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.SwingConstants; class my { public static void main(String args[]) { JFrame f=new JFrame("Web layout..."); ImageIcon pic1 = new ImageIcon ("images/3d.png"); ImageIcon …

Member Avatar for JamesCherrill
0
4K
Member Avatar for Morley93

Hi all, I'm a long time reader of the forums and thought this would be a good place to ask a question. For the record, I am very new to Java! Basically, I have a [I]MainClass[/I] which inherits JFrame, the constructor for which sets window size, title etc. It also …

Member Avatar for Morley93
0
555
Member Avatar for 03hasnam

[CODE]import javax.swing.*; import java.awt.event.*; import java.awt.*; public class Login extends JFrame{ JButton SUBMIT; JPanel panel; JLabel label1, label2; public static int accessGrant = 1; JTextField username; JPasswordField pw; public Login() { label1 = new JLabel(); label1.setText("Username: "); username = new JTextField(15); label2 = new JLabel(); label2.setText("Password: "); pw = new …

Member Avatar for NormR1
0
147
Member Avatar for Dmiller071

Hi all, I have a slight problem with a java applet of mine. I play a video game that tracks realm and world ranks and I'm making this applet to put on my site to display current standings. My main problem is currently in the testing of this applet. Once …

Member Avatar for Dmiller071
0
273
Member Avatar for 03hasnam

[CODE]import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import java.text.*; import java.lang.*; import java.util.*; import java.io.*; public class PaymentNewGUI extends JFrame{ private JButton tenP, twentyP, fiftyP, onePound, twoPound, payButton; JTextField ticketID; Label lEntranceTime; Label lPaymentTime; Label lTimeDifference; Label lDue; Label lInserted; Label lMessage = new Label("Enter Your Ticket Number"); Container …

Member Avatar for JamesCherrill
0
1K
Member Avatar for roona

Hay everyone I need help I have project in subject programming languages about make one idea on two languages c and java . I have made it in java but I couldn't in c this is the code in java [CODE] Class Link // Link.java // to run this program: …

Member Avatar for zeroliken
0
218
Member Avatar for crazymidget01

I am new to using swing. I am trying to get a picture to be displayed in a Jframe when a button is pressed. I cannot figure out how to make this work. This is what I have so far: [CODE] import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.awt.image.BufferedImage; import …

Member Avatar for mKorbel
0
1K
Member Avatar for 03hasnam

[B]guys please help me with this. my problem is that on PaymentNewGUI class i am finding it hard to extract the entrance time from the file to be displayed on the gui if correct ticket number is added, reference to enterListener method in paymentnewGUI class thank you[/B] [CODE]import java.awt.*; import …

Member Avatar for 03hasnam
0
174
Member Avatar for hszforu

HI!! I would like to know some of the alternatives for java swing. I have to create some kind of multithreaded bots for multiple account creations,Scraping etc. using proxies.Although i would like to ask is Java capable of handling this type of bots,because i have read over the internet that …

Member Avatar for hszforu
0
164
Member Avatar for Joey_Brown

Hello; Well, I need to create a program that randomly inserts new different sized spheres into a swing panel and animates them [movement is delimited by the width and height of the frame - when they collide with the frame they bounce to a random direction]. How could I accomplish …

Member Avatar for JamesCherrill
0
111
Member Avatar for vijay4

am able to draw different programs on swings using mouse drag.but if i draw one diagram the previous diagram is getting vanished. how to avoid that ? i want to have all the drawn diagrams on the screen [CODE]import java.util.*; import javax.swing.*; import java.awt.event.*; import java.awt.*; import java.awt.Graphics; class draw1 …

Member Avatar for NormR1
0
161
Member Avatar for vaironl

Could someone please tell me why is my JScrollPane not aligning together with my JLabel of description? I want my label "Description:" to be right next to my JScrollPane which contains a JEditorPane. [CODE]import java.awt.FlowLayout; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.SplashScreen; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import …

Member Avatar for autorunman22
0
174
Member Avatar for infinitus

Hello there I have been given an assignment at Uni to write program (obviously thus im here hehe) The user (customer wishing to purchase a computer) should be able to login by typing his user name and password and pressing the “Login” button. The layout of this first screen of …

Member Avatar for infinitus
0
256

The End.