32,199 Topics

Member Avatar for
Member Avatar for jtodd

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 …

Member Avatar for jtodd
0
743
Member Avatar for bibiki

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, …

Member Avatar for bibiki
0
344
Member Avatar for enlight_1016

... 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 …

Member Avatar for stultuske
0
173
Member Avatar for gingerfish

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, …

Member Avatar for stultuske
0
238
Member Avatar for letlet_pogs

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; } …

Member Avatar for balajimarisetti
0
2K
Member Avatar for YottaFlop

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 …

Member Avatar for YottaFlop
0
191
Member Avatar for beforetheyknew

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 …

Member Avatar for gangsta1903
0
421
Member Avatar for emilo35

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 …

Member Avatar for emilo35
0
182
Member Avatar for solomon_13000

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.

Member Avatar for solomon_13000
0
49
Member Avatar for dippy78

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.

Member Avatar for peter_budo
0
143
Member Avatar for app_path

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 …

Member Avatar for javaAddict
0
105
Member Avatar for rena0514

[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 …

Member Avatar for stultuske
0
135
Member Avatar for chixm8_49

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 …

Member Avatar for chixm8_49
0
90
Member Avatar for Leigh Reed

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 …

Member Avatar for sealxlion
0
143
Member Avatar for iammirko

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 …

Member Avatar for gangsta1903
0
149
Member Avatar for pf0616156
Member Avatar for GradStudent

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 …

Member Avatar for GradStudent
0
161
Member Avatar for ashkash

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 …

0
67
Member Avatar for BrianK123

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 …

Member Avatar for stultuske
0
2K
Member Avatar for DifficultUsrnme

[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 = …

Member Avatar for BestJewSinceJC
0
124
Member Avatar for archanab45

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?

Member Avatar for stultuske
0
59
Member Avatar for pfuturama
Member Avatar for stultuske
0
107
Member Avatar for oneofakind007

How do you store an array into another array? can you store a multidimensional array into an array? if so how?

Member Avatar for kvass
0
46
Member Avatar for localp

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 …

0
55
Member Avatar for PhiberOptik

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 …

Member Avatar for PhiberOptik
0
151
Member Avatar for ceyesuma

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 …

Member Avatar for ceyesuma
0
189
Member Avatar for mahdi68

Hi How can i know in java , pc is connected to internet or no (is online or offline) ??? thanks

Member Avatar for mahdi68
0
96
Member Avatar for Clawsy

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 …

Member Avatar for Clawsy
0
226
Member Avatar for aaanchal

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; …

Member Avatar for darkagn
0
180
Member Avatar for chixm8_49

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 …

Member Avatar for darkagn
0
96

The End.