3,978 Topics
![]() | |
i'm writing a small desktop application to store details entered in to a swing ui.this application saves, edits and deletes the records.every thing is working fine but when writing searching functionality when i search the records i'm able to fill the searched record in to the text fields successfully.but if … | |
I want to draw an image at X Y position when the user click the mouse so I'm using an InternalFrame with layout set to NULL , inside a JFrame with Layout free - using netbeans here is the image class [CODE=java] package myPak_1; import java.awt.*; import java.awt.image.*; import java.io.*; … | |
I have a JFrame with 2 JPanels...my problem When I attach one of the JPanels to the JScrollPane object, it encompasses the whole JFrame, instead of just the JPanel I said to attach to. The scrollBar goes all the way up to the top of the JPanel I don't want … | |
I'm in the process of creating a program that would change a background color by pressing a button. Now, I already have everything set up. The background image is just an image of a rainbow, and when a button is clicked, it would change the whole background color. The thing … | |
I have two graphics methods in my program. One for the menu and one for the game. I have previously written all of my code in one graphics with a bunch of nested ifs. Now I am trying to separate the two. Is there a way to call the gameGraphics … | |
Hi, This application does everything but show the circles and rectangles even though visible is set to true. [CODE]package Shapes; import java.awt.*; import javax.swing.*; public class ShapesTest { public static void main (String []args){ String input = JOptionPane.showInputDialog ("Enter 1 to draw rectangles\n" + "Enter 2 to draw ovals" ); … | |
I made the 4 buttons with top, move up, move down and bottom. But I took open the files for test.txt in LJist and it won't move it How do I add something. I will show you the code. And I saw Error for to press move down, it won't … | |
there is a problem with java code i need your help plz as soon as you can [CODE]import javax.swing.*; import java.io.*; /** *Homework #1 CaesarCipher.java *program to encrypt and decrypt stuff */ public static void main(String[] args) { ceasar1 cc = new ceasar1(); public class ceasar1 { public String dataencyptS, … | |
Hello, I am trying to learn how to use animation, and i have it working a little but I can't get it to move my box. I was wondering if someone might be able to let me know what I am doing wrong here. [CODE]<script language="javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> … | |
[COLOR="Green"]Hey Everyone, Started Java for couple of months now and still struggling to put things together.Any assistant will be highly appreciated. I wanted to display an initial menu screen with the following set of options: 1. Display the current score for each possible response. 2. Vote 3. Quit the program. … | |
[COLOR="Green"][B]hi everyone .. I hope to help me :) .. i have java code.. the main idea of it the user selected from menu the equation (liner - Cubic - Quadratic ) need of them and then user enter the value of x and y and then draw the main … | |
I'm getting errors, and I'm not sure why. Any help would be appreciated. I'm working on this program and when I put the ActionListener for the comboBox it blows up. I chose a topic from the comboBox that will pick a file to be read. When I comment out lines … | |
i want to repeatedly replace e by o from the words Hello World to be Holle Werld [code]import java.awt.*; import java.applet.*; import java.lang.String; import javax.swing.JOptionPane; public class StringExercise1 { public static void main(String[] args) { String textString; textString = JOptionPane.showInputDialog("Enter a string:"); replaceAll(textString); System.out.println(); System.exit( 0 ); } public static … | |
Okay, So this code I have is giving me an error: non-static variable this cannot be referenced from a static context. Here is the code: [code=java] package macey; /** * @author WolfShield */ import java.awt.*; import java.awt.event.*; import javax.swing.*; public class DemoConv implements ActionListener { private JLabel answerL; public static … | |
I'm working on a java program in netbeans and I have it working except to run it I have to right click the main file and tell it to run instead of just clicking the run button. Any help would be appreciated. Sincerely yours; jdm [CODE] /* * To change … | |
I want to display the quote (character) into a text in netbeans Swing form. But it shows only last character. Any help would be appreciated. private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: String t = encodeText.getText(); String text = t.toUpperCase(); int[]textnum = new int[text.length()]; for(int … | |
Hi everyone, For a group assignment we have to develop a property trading game similar to monopoly. At the moment we have the GUI developed as well as a basic idea of how to go about doing it but was wondering if anyone could help a bit!:S Is it possible … | |
Hey everyone, New to Java and i was hoping if anyone could assist me.I needed to write a program that could display results of Champions League initial menu screen with the following set of options: 1. Display the current score for each possible response. 2. Vote 3. Quit the program. … | |
Hi, first time poster, and fairly new to java swing.Im trying to make a scrabble game and am stuck while trying to place a letter on the board, or even removing one for that matter. The playing board is just an array of JButtons all derived from a ScrabbleButton object, … | |
Hello, The following custom class has compiler errors where it is not recognizing KeyListener. Any idea on why I am getting this error? [CODE]import java.util.concurrent.*; import java.util.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class worker1 extends Thread { private SynchronousQueue<Object> q; private int i; public worker1(SynchronousQueue<Object> q) { super("Worker … | |
I am making a calculator for a project,using Swing but I am finding one task particulary hard because it is something I have not yet learned. So for this calculator I need a rounding menu I have a list of menu items 0 through to 9 which stipulate the rounding … | |
I am working on a homework assignment where I have to read some annual income numbers from a text file, then determine how much tax is owed assuming the tax bracket is 30%. I am having a couple issues with my code. First: when the message dialog trys to print … | |
i need to input text in a textfield like accountbalance,withraw,deposit,and functions of "cancel","Enter","Deposit",Withdraw, and i need to give a receipt after the transaction. i need help you can add in my yahoomail <EMAIL SNIPPED> [CODE]import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.util.Scanner; public class ATM extends JFrame implements ActionListener { … | |
Okay, I'll just post my code and see what you guys can make of it. I'm getting the error that the 'main' class could not be found, but as you can see I have it in the code. Thanks for the help! [code=java] package macey; /** * @author Mike */ … | |
Hello everyone, I am trying to get an ActionListener to work in Java. On lines 310 and 312 it says 'cannot find symbol: variable calcDisplayF'. I am a complete noob when it comes to Event Handling so any help on this subject would be greatly appreciated. Here is the code … | |
Im planing to have several Methods that will display the question and the answer choices to their coresponding labels and cmdButtons. But somehow i get the error message "void is an invalid type for the variable" when i want to create my method below of my code (i commented the … | |
cacn you help me with this one import java.awt.Graphics; import java.awt.Color; import javax.swing.JApplet; public class Smiley extends JApplet { public void paint (Graphics g) { super.paint(g); g.setColor(new Color (60,10,0)); //outline pants g.drawRect(393,275,199,80); g.drawRect(394,276,199,80); g.setColor(new Color (145,90,0)); //brown (pants) g.drawRect(395,300,197,54); g.fillRect(395,300,197,54); g.setColor(new Color (255,255,255)); g.fillRect(395,275,197,50); //fill white (pants) g.setColor(new Color (32,5,0)); … | |
Hello... Like the title already says, i have a Panel with a TextField and when a text is entered, i want it to appear on a JLabel that is located on another Panel. Can someone give me the Syntax? Or is it more complicated to do? I do not use … | |
Hi, Now I am trying to develop a tool using Java Swing. I have used JTextpane as editor of my tool. Now I want to add Content assist for this JTextpane ,so that I can easily type. My purpose is to provide listing of all objects and functions related to … | |
hey there. I have the following code. I am trying to build an applet that displays all possible (92) ways of arranging eight queens on a chess board with no two of them on the same column, row, or diagonal. I built this as an application and it ran fine. … | |
Hy, I want to use some ExpandBar items in my UI, like those in SWT. I am currently using swing and unfortunately I did not find anything like this yet. So, do you know the class in swing that I can use ? ... or any other advice is greatly … | |
Need help on setting the values of username and password for my log-in menu: [CODE]import javax.swing.*; import java.awt.*; class Profile extends JFrame { private JPanel p,p1,p2,p3; private JTextField tf; private JPasswordField pf; private JLabel l1,l2; private JButton b; Profile() { p = new JPanel(); p1 = new JPanel(); p2 = … | |
I'm making a simple java calculator. I'm done with the GUI part but don't know how to start on it's functions. Anyone can tell and help me how to start it's function? [CODE]import javax.swing.*; import java.awt.*; class Calculator extends JFrame { private JPanel p1,p2; private JTextField tf; private JButton b[]; … | |
Problem i cant get this to compile using Textpad5 any help would be nice on what i am doing wrong seems i cant get the GUI aspect of Java to work and yes i have all latest updates of JDK and JDE [CODE]import java.awt.FlowLayout; //specifies how components are arranged import … | |
I am trying to build an application that finds all possible ways of arranging 8 queens on a chess board in such a way that no two of them are on either the same row, column, or diagonal. I am also trying to do this applying what I think is … | |
Hello, I have a project and I'm working on the important part now. I want to create this interface in the end and informations in DB. This my goal, this is a prototypical interface created with MockupScreens [url]http://i.imgur.com/7rt5U.png[/url] now I created this interface, I think I'm progressing slowly because I … | |
Hey guys, I am very new to Java and I am trying to create a simple GUI and make the background a picture, I've tried to google and look on this site for the answer and also tried to implement the solutions and I simply cannot get anything to work. … | |
C:\My Documents\sprayproject.java:100: <identifier> expected JOptionPane.showMessageDialog("\nTotal fees charged: R"+total+"\nCost exceeding R3000: "+count); ^ 1 error Guys please assist me in rectifying the above error? Following below is my coding... import javax.swing.*; public class sprayproject { public static void main(String[]args) { String name, temp, temp2; int option, acres, farmno, count=0; double cost, … | |
Once again, my friend Kody and I have come to a dilema. We made a Hopper class which makes 2 feet hop forward by our int stepLength. We placed a stop method to stop the feet at the end of the screen, but our instructor wants the feet directly in … | |
hye..I have 3 classes 1.Welcome 2.Admin 3.User At Welcome classes, [CODE]public class Welcome extends javax.swing.JFrame { public Welcome() { initComponents(); } private void initComponents() { jLabel1 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jLabel2 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jLabel1.setText("WELCOME TO"); jButton1.setText("START"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void … | |
[code]import java.awt.*; import javax.swing; public class ATMko extends JFrame { JPanel p1; JButton b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14; JTextField t1; Container c= getContentPane(); public ATMko() { t1=new JTextField(" ",100); b1=new JButton("1"); b1.setBackground(Color.GRAY); b1.setForeground(Color.BLACK); b2=new JButton("2"); b2.setBackground(Color.GRAY); b2.setForeground(Color.BLACK); b3=new JButton("3"); b3.setBackground(Color.GRAY); b3.setForeground(Color.BLACK); b4=new JButton("4"); b4.setBackground(Color.GRAY); b4.setForeground(Color.BLACK); b5=new JButton("5"); b5.setBackground(Color.GRAY); b5.setForeground(Color.BLACK); b6=new JButton("6"); b6.setBackground(Color.GRAY); b6.setForeground(Color.BLACK); b7=new … | |
I'm having difficulty of inserting a value into a column. When I enter a "ID" number and a value in the "last name" text field, I get an error saying that the "mi" text field can't be an zero length string. So, i enter a value in the "mi" text … | |
Hello I would like to implement multiple swing timers, each of which have a different function, but I cannot seem to separate the functions. I have one actionlistener and I cannot make another one. Please help. | |
[CODE]import javax.swing.*; import java.sql.*; import java.awt.*; import java.awt.event.*; import java.lang.*; class Main extends JFrame { public Main(String st) { setLayout(null); setDefaultCloseOperation(javax.swing. WindowConstants.DISPOSE_ON_CLOSE); JLabel lab=new JLabel("Welcome "+st+"!! \n Click OK to Continue"); JButton OK = new JButton("OK"); OK.setMnemonic('k'); OK.addActionListener( new ActionListener() { JButton OK; public void actionPerformed(ActionEvent e) { [COLOR="Red"] Main();[/COLOR] … | |
write a program to read in a list of exam scores (integer percentage in the range 0 TO 100) and to output the total number of grades as well as the number of grades in each letter- grade category (90-100=A, 80-89=B, 70-79=C, 60-69=D and 0-59=F) and what percentage of the … | |
I have made a small example to illustrate my problem. I have overwritten the createToolTip method for a custom JComponent (eventually it will depend on where abouts the mouse is in the component as to what text to bring up) At first I thought it wasn't being called, but i … | |
hello everyone,i need to make an encryption/decryption program and I'm almost finished, the problem is when i tried to add some gui an error about throwing exception keeps showing.. this is the code without the gui and it works just fine because the [B]throws Exception[/B] is in the main.. [CODE] … | |
![]() | 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 … ![]() |
it give an access denied<java.io.filepermission Item.txt write> error any suggestion for a simple id generator? [code]import java.applet.Applet; import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.io.*; import java.lang.*; public class Shoes extends Applet implements ActionListener, ItemListener { Font SansSerif = new Font ("SansSerif", Font.BOLD, 12); Button create = new Button("Create a … | |
I hava my program working, but it will not display in the JTextArea of the GUI. I believe that I am missing a line of code. However for the life of me I just cannot figure it out. Please Help. Here is my code: Thank you for the help!!! [code]package … |
The End.