286 Posted Topics
Re: you could try html in the code like so [CODE] String str; str="<html>IT s1s2 <h1>26</h1></html>"; [/CODE] That will change the size to make it a header, but I do not know how to set the size in html. I'm sure you could find it. | |
Re: If all else fails try buying a new hard drive and reinstalling windows to that or borrowing a working hard drive and booting to that. | |
Re: you could also use [CODE]Math.random ();[/CODE] and then compare the generated number to if statements, each of which contain one option. | |
I am wondering if it is possible to access the windows explorer in Java. For selecting files to open, or a destination to save something (a picture for example). | |
Re: make sure your image is exactly like in windows. instead of [CODE]JLabel img=new JLabel(new ImageIcon("d:/myproject/image1.jpg"));[/CODE] try this [CODE]JLabel img=new JLabel(new ImageIcon("D:\\myproject\\image1.jpg"));[/CODE] | |
Re: [QUOTE=jackmaverick1;1598149]I've never actually used it, but there seems to be a swing class for your purposes. Just Google something like JCalendar, and you should be set. ...THOUGH I MAY BE WRONG!! :-)[/QUOTE] There seem to be many third party softwares that supply a [URL="http://www.java2s.com/Product/Java/Swing/Calendar-Date-Time.htm"]calendar[/URL], but I could not find one … | |
Re: you could use a vector that stores strings and then compare the current word to the words in the vector and if the word already appears then you don't increase the count while if the word does not appear you add it to the vector and increase the word count | |
I am wondering if there is an easier way to check if the mouse is in a rectangle. Currently I am using an if statement like so [CODE] if (mX > rectX && mX < rectX + 20 && mY > rectY && my < rectY + 10){ } // … | |
I have just started making a new program. I barely have any code, and when I load it the frame is clear for like 20 seconds and then it loads what goes into the frame. why does it take so long to load? I have another code that I tested … | |
Re: I made one for physics class, except mine gives out values and then you need to add the colors onto the resistor. download it here: [url]http://www.mediafire.com/?6r9pzn4y1wdmd14[/url] I left out the tolerance on mine That is the whole library (at least as much as we got done) that I uploaded. Give … | |
I am trying to read a custom file extension When reading a string from the file it output the correct string, however when I attempt to read an int it does not output the correct int. Here is my code: [CODE] import java.awt.event.*; import java.awt.*; import java.io.BufferedReader; import java.io.FileInputStream; import … | |
Re: It seems like you did this thinking that you could use the command prompt, however applets a web based programs, so there is no command prompt there. use JTextField(s) to get input and JLabel(s) to output things. use the basic layout for applets: [CODE] import javax.swing,*; import java.awt.event.*; import java.awt.*; … | |
I have this key listener in my application, and it wont work. This is my first key listener in an application, however I have done a mouse listener in one before. Anyway here is my code: [CODE] import java.awt.Graphics; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.*; public class DropGame extends JPanel … | |
Re: I used Ready to program (a really crappy IDE). you cannot mistype anything, it doesn't show you corrections. I suggest you use that, just for the compiling, it is Java 1.4 though. You could use it for the basics. Like I said just use it for the built in compiler. … | |
Hello. I am trying to make a program that has a menu. When you click play , it should (for now) output the text "In Game". It does that. However, it prints the text on a new JFrame. I would like it to print it on the same frame. How … | |
I have a menu that I made, and the first time you select a program prom the menubar and click the launch button it launches the program, however when you select a different program, or to to the menu and reselect the same program then click launch it opens 2 … | |
I have a check button and I was wondering how to get the value from it. When I use this code it gives me that it is selected always, even when it is not. [CODE] public void itemStateChanged(ItemEvent e) { // TODO Auto-generated method stub JCheckBox sourceBox = ((JCheckBox)e.getSource()); wave1Invert … | |
I have this code here [CODE] public void actionPerformed(ActionEvent arg0) { for (int i = 0; i <= 360; i++){ for (int z = 0; z < 9; z++){ xaxisWave1 [z][i] -= 1; if (xaxisWave1[z][360] < 0){ System.out.println("Line out"); for (int y = 0; y <= 360; y ++){ xaxisWave1[z][y] … | |
I have two JSliders that are both going to a common stateChanged Method, but I am having trouble separating them. I assumes they were somewhat like separating something in the actionPerformed method, but it doesn't seem to work. it does however go into the method, it is just the if … | |
I have several different classes and they have graphics in them. I told java to repaint in a class class called LongitudinalWaveGraphics, but it repaints a class called ResistorCCGraphics. Why is this? Thanks for the help. if you need any codes then I can post them. | |
Re: you could also go to school or just volunteer at a place where they design software. | |
Re: if it is an application your IDE may provide an export as executable jar file option (I know eclipse does), or you can use a program called [URL="http://www.syncedit.com/software/javalauncher/"]Java Launcher[/URL], which converts your applications into exes. If it is an applet then you cannot convert it into an exe. | |
How would I go about using swing components and graphics in the same program. Whenever I seem to add a swing component my graphics disappear. Please help. Thanks. My main Class [CODE] import java.awt.*; import java.awt.event.*; import javax.swing.*; public class ResistorColorCodeProgram implements MouseMotionListener, MouseListener, KeyListener{ public ResistorColorCodeProgram (){ JFrame resistorCCFrame … | |
Re: you can use the jpanel.remove(component); Statement and it will remove the component from the JPanel. | |
Re: I suggest you first draw a picture, then figure out what numbers you need, then replicate the picture in java. then expand it to take user input and still calculate the correct answer. | |
I have this part of my code. I have a JLabel and a JButton that are in a panel. The I place that panel into another panel that has a border layout and I set the panel containing the label and button to be "NORTH", but the JLabel does not … | |
is it possible to incorporate a class file that is written in applet into a JLabel in application? I know it is possible to put HTML code in a JLabel, so I copied the code from my html file created when I compile and run the applet. I put it … | |
I have never heard of it. I am researching on how to implement the internet to my program and I come across it. it seems to be easier then what I was trying to do for the past while. Could someone please link me to a website that can provide … | |
I am working if application and I cannot figure out how to make a box move forward one at a time when the spacebar is pressed. Here are my codes: [CODE] package DrawingInApplications; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.*; import javax.swing.JFrame; public class Program extends Drawing implements KeyListener{ Drawing d; … | |
I am tying to use Gridbag layout, but I cannot seem to get it working. [URL="http://img703.imageshack.us/img703/1461/photo00002y.jpg"]here[/URL] is the plan. and here is the code: [CODE] import java.awt.event.*; import java.awt.*; import javax.swing.*; import java.net.*; import java.nio.*; public class Chatroom implements ActionListener { public Chatroom (){ JFrame frame = new JFrame ("Warrior … | |
I have a general idea on how to start. I would need a gui with a screen to display the text and a JTextField to write the text and a send button. I would also need to import the java.new package to connect between the computers, but other then that … | |
Re: Applets are java programs that are required to run in web browsers. Applications are java programs that can act as a stand alone program, and can be converted in exe's and executable jar files. You can only run applications using the command prompt. Applets have to be integrated into websites. | |
Is it possible to communicate with java to a usb that has been converted into an antenna, that sends and recieves signals to/from a remote controlled car? | |
I am trying to sense multiple keys at a time and I am wondering how to use a hash map to do this. | |
I am wondering if I could write this code to a file and then print it at a starting location (like an image). [CODE] g.setColor(Color.white); g.fill3DRect(en1X + 0 * enZ, en1Y - 25 * enZ, 5 * enZ, 5 * enZ, true); g.fill3DRect(en1X + 5 * enZ, en1Y - 30 … | |
Re: you add it under the code at line 103. and if at the top of the code you type [CODE] import java.awt.*; import java.awt.event.*; import javax.swing.*; [/CODE] then you don't need to write out a bunch of extra code every single time you use a JFrame, JPanel, JLabel, JButton, etc. | |
Is there a way to diplay a web page like google in an application in a JLabel for example. Kind of like the new minecraft launcher where it shows the update in a window about the login area. Thanks for any help. | |
Re: try [CODE]ImageIcon fish = new ImageIcon("images\\fish.jpg");[/CODE] | |
Does anyone know of or have a website where you can upload your applets and other people can play them? (like kongregate for flash games) and maybe even make some money every time someone plays your game? If you're wondering why, I need money for school. 0.o | |
I have this code, when run, it is terribly unorganized. It looks like this: [Label Here] [Button Here] [-----TextField Here ----] [invisible Label][Button] my program does this: when something is entered in the JTextField and then you click the [Button Here] then it prints what you printed in the [invisible … | |
Re: I am attempting to make a web browser and that is the bookmarks that I am attempting to write to txt files. | |
![]() | Re: We do not give out codes here. This site is for learning. Please show us what you have so far and we may decide to help you. ![]() |
Re: 1. Make a timer with a delay of 1 [CODE]Timer timer = new Timer (1,this);[/CODE](make sure to implement ActionPerformed). 2. Make a start and Stop JButton and a JLabel. 3. add actionlisteners to the buttons [CODE]startButtonName.addActionListener (this);[/CODE] and program them to start and stop the timer. 4. make a double … | |
Re: you can make it an exe file using java launcher then using Paypal you can upload it and make it available for purchase or download. Or you can upload it to a site like Megaupload and make some cash while distributing your game for free. | |
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 … | |
I have a little problem with my if statement. I have a code where I am comparing if a sprite has moved far enough for another one to generate behind it. Here it is (the dots are choped out code): [CODE]if (unit > 0) { if (moved > speed + … | |
I am having some trouble with the coding for the api. games4j.com has all of the codes and files, but when I insert the api codes into my doe I get an error. Please help me. I am getting the error with these two lines [CODE]loggedIn = Highscore.isLoggedIn(applet);[/CODE] and [CODE]Highscore.save(applet, … | |
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. | |
Is there anywhere I can buy or some way that I can disassemble a usb device so that I can build a circuit or something on it. I would like to get the part that you plug into a computer and build a motor speed control circuit on it possible … | |
This is a very simple timer and I cant seem to get it to work I have tried this () runs but does nothing: [code] // The "Timer" class. import java.applet.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; public class Timer extends Applet implements ActionListener { // Place instance variables here … |
The End.