3,978 Topics
![]() | |
import java.awt.*; import java.awt.event.*; import java.awt.Color; import javax.swing.*; import java.awt.Frame; import java.awt.geom.*; class BallEntity/*THE BALL CLASS*/ { private int top=0,left=0,height=0,width=0; //getter methods public int getTop() { return top; } public int getLeft() { return left; } public int getHeight() { return height; } public int getWidth() { return width; } … | |
Hello, I am trying to override the toString() method and then output an ArrayList to a JTextArea swing component. I will output the list to a gui using an action, but for the method itself, what should the return statement be? I am using return type String on the method, … | |
Hey to everyone out there. I am new to this forum and seeking assistance with a java program assignment. if anyone can help let me know. The program is completed all I have left is to produce accurate output of a students grade. Here is the code: //////////////////////////////////////////////////////////////// import javax.swing.JOptionPane; … | |
Hi programmers I need this code to be completed with the sjf(shortest job first) to be preemptive, it means with arrival times with each process.. Here is my code so far: CpuScheduling1.java Interface: Menu [1]First- Come First-Served [2]Shortest Job First [3]Priority Enter Choice: Note: I need to have the sjf … | |
I'm trying to make a program that will toggle a boolean value and paint a red rectangle on the right side of a swing panel when you press the 'a' key. Unfortunately, I'm not having much luck, because when I hit 'a' nothing happens. My mistake is probably something obvious … | |
My button is not gaving out any action when clicked: (libraryBtn): [CODE]package LibraryDatabase; import static javax.swing.JOptionPane.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; public class PostLibraryDatabase extends JFrame implements ActionListener { // Text Fields XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX JTextField firstName, surName, id, serialNumber, category, dateToday, coverTitle, isbnNumber, authoursName, coAuthoursName, pubDate, loanDate, returnedDate, email, details; … | |
[CODE]import java.io.*; public class DCS2{ public static void main (String [] args) throws IOException{ BufferedReader myInput = new BufferedReader (new InputStreamReader(System.in)); int code, al, nmp, brc; float tf = 0 , ir = 0; String name = "" , description = ""; System.out.println ("Enter Your Barrower's Name"); name = myInput.readLine(); … | |
please me on how to insert a picture am new to netbeans [CODE]package LibraryDatabase; import static javax.swing.JOptionPane.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; public class PostLibraryDatabase extends JFrame implements ActionListener { JTextField firstName, surName, id, serialNumber, category, dateToday, coverTitle, isbnNumber, authoursName, coAuthoursName, pubDate, loanDate, returnedDate, email, details; JButton writeBtn, displayBtn, … | |
Im trying to make it so that my menu options that i've highlighted are their own method but i was having issues with returning them so i could use the selection as an int for my switch statement.Any ideas? [CODE]import javax.swing.JOptionPane; public class ConversionProgram { /** * @param args */ … | |
This is the assignment: Write the program in Java (with a graphical user interface) and have it calculate and display the mortgage payment amount from user input of the amount of the mortgage and the user's selection from a menu of available mortgage loans: - 7 years at 5.35% - … | |
I keep getting these errors when I try to run the program Exception in thread "main" java.lang.NumberFormatException: For input string: "GTR" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) at java.lang.Integer.parseInt(Integer.java:449) at java.lang.Integer.parseInt(Integer.java:499) at Inventory6.addProductToInventory2(Inventory6.java:549) at Inventory6.main(Inventory6.java:734) I've spent hours trying to figure out what I'm doing wrong and it's due in a few hours. I … | |
im trying to figure out how to get the max and min of the values that are entered if i run this program. I want the user to enter in a series of numbers until they were finished and to terminate it to type -99. I'm having quite a few … | |
plz tell me where i am stuck.how could i solve this package drawing; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.io.File; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.*; import javax.swing.event.*; /** * * @author */ … | |
Ive made this calculator using java swing.I want to add new buttons to my frame if user selects 'Scientific' from file menu and remove buttons frome the frame if user selects 'Standard' from the menu. By default it is selected to standard. Write now a new window pops up above … | |
Ive made this calculator using java swing.I want to add new buttons to my frame if user selects 'Scientific' from file menu and remove buttons frome the frame if user selects 'Standard' from the menu. By default it is selected to standard. Write now a new window pops up above … | |
import javax.swing.*; import java.awt.*; import java.awt.event.*; import javax.swing.text.*; import java.text.*; public class Vhea extends Frame implements ActionListener{ JFrame frame; JPanel panel1, panel2, panel3; JLabel inputLabel; JFormattedTextField inputField; JButton button; Container contentPane; JOptionPane optionPane; String inputTxt=""; public static void main(String[] args) { Vhea tm = new Vhea(); } Vhea() { frame … | |
[code]import java.sql.*; import javax.sql.*; import javax.swing.*; import java.applet.*; import java.awt.event.*; import java.awt.*; public class Display extends JFrame implements ActionListener { JLabel l1; JTextField t1,t2; JButton b1,b2; public Display(String s) { super(s); l1 = new JLabel("user name"); b1 = new JButton("submit"); b2 = new JButton("reset"); t1 = new JTextField(20); t2 = … | |
Java - Is it possible to run the swing class in the applets. I'm having problems running the message windows inside the applet windows... any suggestions? I may need to know this for my future programming assignments. Thanks! | |
Hi everyone, I'm having trouble inserting icons into a textpane and I'm not sure why. I'd like to set up a textpane and then be able to insert and display images in that textpane during runtime. As a test I've written the code below for a simple GUI with a … | |
Is this possible? I'd like to add a java file in each tab of this JFrame. I've already created the files, I'd just like to show both files in one. The files I'd like to add are commented out: storageSP and calculatorEDL [CODE] import javax.swing.*; import java.awt.event.*; public class TabbedPane … | |
Hi all, I've been struggling with a Swing issue for days now, maybe someone can help me :) I would like to see several icons at the left hand side of a JTree element. Is that possible? I mean i know that I have to create some tricky cell renderer … | |
hi i am trying to make a currency converter to convert British pounds, US Dollars and Euros . i have the GUI made but i wanted to make a separate class to handle the conversion of the currencys but im not sure where to start so i was wondering if … | |
I'm working on an Image editor for a class project. I am stuck trying to display the image onto the panel with a button. My action listener is working fine. I don't know if the paint component is working right. help please. Here is my code for an Image Viewer … | |
Hi all, First I would like to say how much I like the forum. I have recently started to program using Java and I have done a online tutorials from [URL="http://www.javavideotutes.com/home"]http://www.javavideotutes.com/home[/URL] and I now have a few questions: 1) What is a good book for me to get? 2) I … | |
m doing MCA.i needed some project topics based on java swing | |
Having homework issues again. This code compiles but when I try to execute it it gives me an "exception in thread main java.lang.nosuchmethoderror main" Can anyone help me due tomorrow....Thanx [CODE] import java.awt.*; import java.awt.event.*; import java.text.NumberFormat; // used to format currency import javax.swing.*; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JButton; … | |
[CODE]import javax.swing.*; import java.awt.*; class drawer extends JPanel { Color color; int x; drawer(int x,Color color){ this.color=color;//color of rectangle this.x=x;//size } public void paintComponent(Graphics g) { super.paintComponent(g); g.drawRect(0,0,x,x); g.setColor(color); g.fillRect(0,0,x,x); } } public class layers { public static void main(String[] args) { JLayeredPane layerd=new JLayeredPane(); layerd.setSize(800,800); layerd.setVisible(true); layerd.add(new drawer(50,Color.BLUE),2); layerd.validate(); … | |
Hi: I'm working on a mini-game ish sort of applet using Eclipse. I am trying to get a picture I have in my folder of a dot to show on my applet. and be able to move it freely. Since I have other parts of the game planned out, parts … | |
hey..im new to JAVA...i wanna use an Icon for a JButton..i did it already but unable to do so in the project that im making.... the back.gif is in the same folder as the .java file...it compiles well... just shows a blank white icon.... can you please find the problem … | |
For my application we use scan guns to scan barcodes to do various things. My issue is with tabbing. We scan a barcode that represents the ">" sign. When focus is on the combobox box and they scan the ">" sign it places the ">" in the combobox. How can … | |
[CODE][/CODE][COLOR="Green"][B][/B][/COLOR]Hi everyone! Question??? I have created a source code for converting Decimal numbers to Binary. I haven't done this in a while so I need a litte help on figuring out what is wrong with my code. The problem is I enter the JOptionPane class in order to prompt the … | |
I need to write an application that reads a distance in metres. The program will then convert the distance to kilometres, feet and inches, by calling methods. Here is my code so far... looking for pointers please. [CODE]import javax.swing.JOptionPane; import java.text.DecimalFormat; /** This program converts meters to kilometers, inches, and … | |
Basically i want to make a platform game in java purely from the java 2d graphics. I have managed to link the keyListener to update variables which my graphics pane can then use to draw my images. But i cant do is get my image to refresh after the variables … | |
[CODE]import javax.swing.*; import java.awt.*; import java.awt.event.*; class plc extends JPanel{ plc() { this.addKeyListener(new MyKeyBoardListner()); System.out.println("key listner added"); } public void paintComponent(Graphics g) { super.paintComponent(g); g.drawRect(0,0,10,60); g.fillRect(0,0,10,60); } private class MyKeyBoardListner extends KeyAdapter { public void keyPressed(KeyEvent ke) { System.out.println(ke.getKeyCode()); } } } public class plank { public static void main(String[] … | |
I have to write this applet for my CIT 130 class. I understand that you can not give solutions nor do I want you to do my homework for me I just need some pointers. The questions ask to "Write an applet that draws a house with it's door and … | |
m unable to run executable jar.I created one on swing based prgm using command: jar cmf my.mf demo.jar *.* .....problem is this that it does not show everything added on Jframe..it just shows a frame and no buttons,textfields,etc which i have added... waiting for a good response..!! | |
Here Is My Code i am done with it and it works fine but i want to make this run in loop . like i want this program to ask Would you like to enter another Student Grade <Y/N>... Here Is the Code .. If Any 1 Can Help Plz … | |
In my application I use a class that extends a JDialog. When my application encounters certain errors this diaglog should popup with the appropriate message. The problem I have is that after the message appears, when I click the OK button, the message reappears one or sometimes two more times … | |
When a user Scans a barcode representing a # sign while focus is on the fromComboBox, code is used to scroll through the list. It scrolls through the list fine, but then it moves to the next field on the screen, because the scanner (that is what we use for … | |
simo1.java [CODE]import javax.swing.*; import java.awt.*; import java.awt.event.*; public class simo2 extends JFrame implements ActionListener{ private JRadioButton red; private JRadioButton yellow; private JRadioButton blue; private JRadioButton green; private JRadioButton magenta; public simo2() { setLayout(new FlowLayout()); setVisible(true); setSize(400,250); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); red=new JRadioButton(" red"); yellow=new JRadioButton(" yellow"); blue=new JRadioButton(" blue"); green=new JRadioButton(" green"); magenta=new … | |
this code shows the second oval only when maximize is pressed otherwise only the one oval is shown and the first oval does not go to the getHeight() where as the one appearing after maximizing repaints correctly [CODE][/CODE][code]import javax.swing.*; import java.awt.Graphics; class drawpanel extends JComponent implements Runnable { int i=10,startx; … | |
Hi, I am having issues while comparing of cards.As i starts the card game and clicks on first button the card opens and when i click on the any other button if the button i have clicked matches with the image on the first button both the cards stays open … | |
here's my code, i wanted to add another button that would have its own ActionListener. NOTE: its in object oriented style. i wanted to add these codes in my main class for my additional buttons, but my problem is i dont know how to make their ActionListeners. [CODE]myButton2=new Button("GET DIAMETER"); … | |
I am trying to make a rectangle which can be resize when i stretch its borders and this rectangle will drag n drop also.this rectangle will grab a jpeg picture and paste in new panel area.nay help is appreciated thank you.... | |
i have this program...the color program..but i have a problem on converting a string to character. anybody can help me..thanks.. below is the java code import javax.swing.JOptionPane; public class ab{ public static void main(String[]args){ String a; a=JOptionPane.showInputDialog("Enter color: "); // I need to convert the variable a from string to … | |
Hi I am new to this forum and want some help with some Java code. I am creating a Three Tier Structure and below is the GUI class of the project. The problem is I can't make it work to insert into the Database file. Could someone please help me … | |
hello frnds....i am mukul working on a java project using mysql database and swings in netbeans ide can anyone tell me how to retrieve data from mysql and show tha data in JTable......in netbeans....... i know how resultset and statements commanda.......but dont know how to show that data in JTable | |
Hello Everyone, I want do a project on Java Applet/Swing for my final yr. Can anyone give me suggestions what kind of projects , specifically on what topic I should choose which can help in campusing. Frankly, I love programming in Java. Hope to get a reply from you. Thanking … | |
Palindrome is a popular title for programming training. You may compare a pair of chars in a string, or a pair of words in a String array. Many homeworks are made in this way. Further more, in Java we may play with all the speaking languages in the world, such … | |
[CODE]import java.io.*; public class inout{ public static void main (String[] args){ int a; BufferedReader num= new BufferedReader(new InputStreamReader(System.in)); try {System.out.println("Enter a number: "); a = integer.parseInt(num.readLine()); System.out.println("THE NUMBER IS" + a); } catch(IOException e) {System.out.println("ERROR"); {}}[/CODE] [CODE]import javax.swing.*; public class jopt{ public static void main(String[]args){ int x; x = Integer.parseInt(JOptionPane.showInputDialog("enter … |
The End.