32,199 Topics
| |
Hello everyone! I am new to Java so this may be a very easy question. I am trying to write a program and display just the remainder after two numbers have been divided. Here is where i am: import java.util.Scanner; public class Midterm1 { public static void main( String[] args … | |
hey there, I have the following code: [CODE]import java.awt.*; import javax.swing.*; public class TabelaEShahut extends JPanel{ public static void main(String[] args){ new TabelaEShahut(); } public TabelaEShahut(){ JFrame f = new JFrame(); f.setSize(500, 500); f.setVisible(true); f.setTitle("shah"); f.getContentPane().add(this); } public void paintComponent(Graphics g){ g.setColor(Color.white); g.fillRect(0, 0, 700, 700); g.setColor(Color.red); g.fillRect(50, 50, 400, … | |
... I need help.. :( ....please teach me how to make formulas that can input in showInputDialog .. :( As a private math tutor for grade school children, you design an application to teach multiplication tables. As a prototype for your design, you begin with the number two. One set … | |
Hi How can i change my application default java icon with my own? The problem is that my frame dont have a name =( [CODE] ..... public Main() { super("PDB Viewer"); GLCapabilities caps = new GLCapabilities(); caps.setDoubleBuffered(false); canvas.addGLEventListener(new SecondGLEventListener()); canvas.addKeyListener(new SecondGLEventListener()); getContentPane().add(canvas, BorderLayout.CENTER); canvas.requestFocus(); initComponents(); pack(); setBounds( 150, 20, 800, … | |
Hello. I am trying to return an array and print the values. [code] public class Sample { public static void main(String args[]){ for (int i = 0 ; i<getNames().length;i++){ String a[] = new String[getNames().length]; System.out.println(a[0]); } } public static String[] getNames() { String names[] = {"bob", "jim"}; return names; } … | |
Hi, in a Java Applet there the keys control movement, I have a couple of questions (sorry for the disorganized nature of multi-item requests). 1.[CODE=C] if (key=KeyEvent.VK_RIGHT) { x++; } [/CODE] But, as you might have guessed by this post's title, the movement delays before continuing its motion, as a … | |
Hi guys i've written a hash table as a collection for a program the key is a string, show below: [CODE]private Hashtable<String, Planes> planesFlying = new Hashtable<String, Planes>();[/CODE] How can i write a comparator to sort this into alphabetical order? i've tried a lot. Do you need to overide equals … | |
So, a while ago I wrote a SerializableImage class in order to easily bundle several images together into a single file. The class worked fine, both serializing, file I/O and drawing. In another project I'm working on I successfully used a copy of this SerializableImage class, until recently. I had … | |
I would like to find out do we declare a class as persistent only when it represents the data in the database. In other words when we create a persistent object then we can store the state of the object into the database. | |
Hi, Please guide on whats the best practice to return multiple rows in JWS to the consuming client application. Currently i'm using Netbeans 6.7. Thanks. | |
| Hi I would like to know which of the following is correct uni-directional association between class A and class B.(A->B) 1. [CODE] class A { int num; B obj_B; A(){ //constructor code; } } class B { int num; B(){ //constructor code; } } [/CODE] 2. [CODE]class A { int … |
[CODE]//PizzaPanel.java Author: Carien Anderson import java.awt.*; import javax.swing.*; import javax.swing.border.*; import javax.swing.JOptionPane; import java.awt.event.*; public class PizzaPanel extends JPanel { public PizzaPanel() { setLayout(new BorderLayout()); setBackground (Color.white); setPreferredSize (new Dimension(700,280)); //North panel JPanel ppan1 = new JPanel(); JLabel l1 = new JLabel("Lets Eat!"); ppan1.add(l1); ppan1.setBackground(Color.green); add(ppan1, BorderLayout.NORTH); //West panel JPanel … | |
Hello! I would like to ask on how to create a node using GUI (pseudo code will really help) . It seems that my code does not create a node. I used JLabels and ActionListener to retrieve the data from the JLabels. My plan is to input all the necessary … | |
I am a uni student just starting out with java and getting more confused by the day. Can someone tell me what I have done wrong? It should input all of the strings and place them in the appropriate place in the bottom sentence. [code]import java.util.Scanner; // Needed for the … | |
Hi, I have used the following code (this is from HeadFirst Java Book) [CODE] import java.awt.*; import javax.swing.*; import javax.sound.midi.*; import java.util.*; import java.awt.event.*; public class BeatBox { JPanel mainPanel; ArrayList<JCheckBox> checkboxList; Sequence sequence; Sequencer sequencer; Track track; JFrame theFrame; String[] instrumentNames = {"Bass Drum", "Closed Hi-Hat", "Open Hi-Hat", "Acoustic … | |
i need some example code. | |
How does Priority Queue work. This is my scenario, I have certain objects with priorities 1,2,..10. There could be multiple objects with same priority. I was thinking I can put them into a priority queue and let the pool() give me the objects with highest priority.. ? I m kinda … | |
I have a 2d array with x and y coordinates. I need to figure out the north most, south most, east most, and west most points and print them out. I figure the best way to do this is to find the minimum x value and the corresponding point will … | |
I have a series of of JOptionPanes pop up to get info from the user. However, if the user presses cancel, the machine gets an error (which is prevented). I'm trying to catch this and force the user to make a choice and press OK. MY code doesn't seem do … | |
[code] import java.io.*; import java.lang.*; import java.util.*; class CustomerInfo { public String name = new String(); public String accnNumber =new Sting(); public String accnType = new String(); public float balance = 0.0F; public float rateOfInterest =0.0F; public float interest = 0.0F; public float useBalance = 0.0F; public String password = … | |
i have written a java prg that reads a jpeg image&gives height,width of the image.I want to store the output in a separate file .How can I do this? | |
can anyone explain with me briefly of instance variables and local variables. | |
How do you store an array into another array? can you store a multidimensional array into an array? if so how? | |
I got 2 machines both has the same operating system (Linux based), lets name these machines as PC 1 and PC 2. PC 1 has a hello world program that displays in a GUI, when we pass the command " java helloWorld smith " (smith is the parameter), and we … | |
Hey guys I'm using Tiled (mapeditor.org) for the mapping in my game and I have made a few maps, and started implementing them in my game. The first thing I had to do was decode them from base64, then gunzip the string. Now I am on the last step and … | |
Why does this give the error "cannot reference this before supertype constructor has been called" I thought that is the first thing I did in the constructor. [code] /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package application1; import … | |
Hi How can i know in java , pc is connected to internet or no (is online or offline) ??? thanks | |
Hi, I have little experience with writing to Http socket. I am trying to send data to another computer through Http protocol, just like having a chat between two application but instead of using Socket connection I want to use Http connection. The server writes to [I]http[/I] connection data and … | |
i m working with this program but dont know how to add counter in it in order to check running / execution time of program.please help me. and telll how and where to add code for this task?plz reply soon. public class InsertionSort{ public static void main(String a[]){ int i; … | |
Hello. I am constructing a database using GUI. I wanted to have all my containers to be on one window. I am having a problem on how to have these containers on one window. Any suggestions? I am very sorry if the code was seem weird. Here's the code: [CODE]public … |
The End.