32,204 Topics

Member Avatar for
Member Avatar for soham.m17

JLabel[] x=new JLabel[10]; int i=0; for(component comps : a.getComponent_list()) { x[i]=comps.getType().getImg(); x[i].setBounds(comps.getPosition().x, comps.getPosition().y, comps.getType().getWidth(), comps.getType().getHeight()); System.out.println("Coming Here,"+comps.getId()+","+comps.getPosition().x); this.add(x[i]); i++; } repaint(); I want to have all the labels in their position. after this function. but only the last added label is shown. What can I do?

Member Avatar for soham.m17
0
720
Member Avatar for soham.m17

Suppose below is my code : public void paintComponent( Graphics g ) { graphics2D = (Graphics2D)g; graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); graphics2D.setPaint(Color.white); graphics2D.fillRect(0, 0, getSize().width, getSize().height); graphics2D.setColor(Color.black); } and graphics2D is global variable declared like : private Graphics2D graphics2D; Now, how can I access g to draw lines from other methods? When I'm …

Member Avatar for NormR1
0
95
Member Avatar for renzlo

Hi Java Developers, I don't know if this is the right place to ask but I hope It is. First of all this is not my programming language, I am an intermediate .net developer, I just came up with this problem that I need to solve which what the thread …

Member Avatar for renzlo
0
327
Member Avatar for bhawna_5nov

here is the following code in java applet.. [CODE]//this is one applet which has to be opened when button is clicked... import java.awt.*; import java.applet.*; import java.awt.event.*; public class Order_info extends Applet implements ItemListener { private Label l,l1,l2; private TextField t=new TextField(); private Choice list; String s,selection; public void init() …

Member Avatar for NormR1
0
1K
Member Avatar for pritish.kamath

i wanted to display a pattern like this 4444 333 22 1 i used the following code import java.util.*; public class PatternExp { public static void main (String args[]) { Scanner src=new Scanner(System.in); System.out.println("Enter the number of lines needed"); int n=src.nextInt(); for (int i=n; i>0; i--) { for(int j=n; j>0; …

Member Avatar for pritish.kamath
0
128
Member Avatar for m1n1m3

Hi, I have a simple usb device that i can plug into a PC. The thing im looking for in user interface that is: 1) Multiplatform 2) Manages it own drivers (for plug in USB device) 3) No install file, a executable. The thing im looking for is like this …

Member Avatar for jackmaverick1
0
295
Member Avatar for agieli

hi guys,i'm new to bluetooth programming using java(Bluecove 2.1).i'm trying to establish connection between my pc and bluetooth device(my mobile phone). any help will be appriciated thank you

0
64
Member Avatar for jackmaverick1

I've got a game, and I'm trying to do it right. I've got a spritesheet (which is really just a class that loads images for easy access. It seems to work, but then my tile system starts, and it fails in an interesting way - it loads only the foreground, …

Member Avatar for jackmaverick1
0
196
Member Avatar for CWoods22

I am having trouble getting this to run. It compiles just fun, and it will let you click one button but does not recognize a second button click. What am I doing wrong? /* Chapter 6: Telephone Keypad Programmer: Charlene Wood Date: April 8, 2012 Filename: TelephoneKeypad.java Purpose: This program …

Member Avatar for NormR1
0
415
Member Avatar for apanimesh061

I want to extract unique elements from a string. import java.util.HashSet; import java.util.Iterator; import java.util.Set; import java.util.StringTokenizer; /** * * @author Animesh Pandey */ public class Main { /** * @param args the command line arguments */ public static Set getUniqueTokens(String str, String separator) { StringTokenizer tokenizer = new StringTokenizer(str, …

Member Avatar for NormR1
0
154
Member Avatar for nixufix

Hi, To start with I'm new to Java and this is my second project: to create a graphical TicTacToe game with MVC pattern. View and Control will be in the same class for this project. The goal is to learn about interfaces and to split your problems into seperate parts. …

0
355
Member Avatar for jackbauer24

My son found [this](http://www.sourceforge.net) website and wants to make his own project. This is what he has learnt:- * Inheritance * Serialization * GUI * KeyAdapter * Everything basic He also wants it to be iterative (version 0.1, only bones, ver 0.2 some updating etc). Could you suggest any programs …

Member Avatar for DavidKroukamp
0
137
Member Avatar for blackmagic01021

I want to create a message table, where every incoming message is saved as a row in a message. According to the picture below. Any introductory help will be very helpful. I already have á application where the messages are printed on a textarea, but for further inhancment I want …

Member Avatar for JamesCherrill
0
145
Member Avatar for blackmagic01021

I have a class that has a text area. the code is as follows package view; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.ScrollPaneConstants; public class LabelStatus extends JPanel { /** * */ private static final long serialVersionUID = 1L; …

Member Avatar for blackmagic01021
0
169
Member Avatar for Panathinaikos22

I have 2 files writen in java, if someone can please covert them in C# and give it. The problem is with type of variables and operators, many operators are not overloaded like in java, idk what to say... This one will not work in C# as integer result |= …

Member Avatar for wilen
0
278
Member Avatar for Majestics

Its not a new question, i already searched many forums and found many answers but the builders i found arent able to compete with builder of vb.net and c#.net, so i thought to take some decision from some experience people , please give me some of your suggestions. I already …

Member Avatar for CrazyDieter
0
317
Member Avatar for koduruabhinav

i have image on my web application. When i click that i will be redirected to track jsp.What that jsp does is track the image that is clicked and redirect to that image url .At present i asing response.sendredirect(URL) which will redirect in same window.Is there any possiblity to open …

Member Avatar for CrazyDieter
1
116
Member Avatar for jarograv

I am getting a null pointer exception on line 36 of this code, I do not understand how any of my values are null because they should all be filled with data from the text document. What am I doing wrong? import java.io.BufferedReader; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.InputStreamReader; public …

Member Avatar for BumHunter
0
120
Member Avatar for joankim

Hi there. Recently, i wrote a program that would return ridiculously high numbers as BigIntegers. The program is working at all, but when the BigIntegers get to a value that I have estimated to be around 2^329554, and takes up between 30-45 kilobytes, i get this error: Exception in thread …

Member Avatar for joankim
0
148
Member Avatar for <HHH>

i'm trying to read data from .csv file and it give me grabage so i will be pleased if someone help me thanks import java.io.*; public class ReadFile { public void File2 () throws FileNotFoundException, IOException{ FileInputStream fstream = new FileInputStream("C:/myfile.csv"); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new …

Member Avatar for joankim
0
347
Member Avatar for sadzee

What are Locally caught Exceptions in Java? Whats the dofference between the ones that are caught locally and ones that are not caught locally??

Member Avatar for nbajordan
0
88
Member Avatar for Checkerboz

Hey! I got two classes here, one that does stuff with an image and one class utilizing the other class. So inside my picture class I have an Image object and in my other class I want to have a JFrame and I want to set the size of the …

Member Avatar for Checkerboz
0
349
Member Avatar for Thermalnuke

having a problem with a program im working on with inheritance. suppose to output the area, perimeter, and area i think i have it all set up correctly but its not out putting correctly here is the the superclass that inherites to the client form. public class CIRCLE extends CLIENT …

Member Avatar for Thermalnuke
0
135
Member Avatar for jhamill

okay, i am trying to implement a program that cycles through a circularlly linked list to find different strings "assassins" and then eliminate the next person in the list. I believe that most of my code is correct with the exception of how I set up my linked list as …

Member Avatar for jhamill
0
264
Member Avatar for lena1990

hi all i have applet that i want to connect to the server when i run the applet from the appletviewer the applet connect to the server ,but when i run the applet from web browser i have the following exception java.security.AccessControlException: access denied ("java.net.SocketPermission" "127.0.0.1:3000" "connect,resolve") even i give …

Member Avatar for Darryl.Burke
0
310
Member Avatar for bo0ga

If I highlext text on a website, is there a way for a program to automatically have it copied and pasted into an external program, say Microsoft Word? I would want to highlight text, and then right click and have a program function added to the other functions that show …

Member Avatar for bo0ga
0
167
Member Avatar for joankim

First I would like to state that I am almost positive that this is a bug in Java, not a coding mistake by me. This program is designed to print the first n (inputted) square triangular numbers (STN's). A STN is a number that is both a perfect square and …

Member Avatar for joankim
0
245
Member Avatar for Stjerne

Hello, I've no experience with layouts, and I want to learn it, especially how to place components in the right places. I'll give an example, and I was wondering if you could help me? **Main class:** import javax.swing.*; import java.awt.event.*; public class Main { public static void main(String[]args) { final …

Member Avatar for Stjerne
0
167
Member Avatar for c.pentasuglia

I'm working on a project, and i put in some code to tell the program when to stop. Basically it completes it's task then shuts itself down, however it outputs information to a text box aka log. I'd like to stop the program from running, yet leave the log open …

Member Avatar for c.pentasuglia
0
240
Member Avatar for c.pentasuglia

So i have a jar of a project that i was working on, and i want to use it as a library in another project (resource adapter). I have brought it into the libraries folder, and used an import. I basically want to be able to call that whole project …

Member Avatar for c.pentasuglia
0
296

The End.