32,199 Topics
| |
| Is there a way to improve the below Selection Sort code to make it more efficient? [ICODE] int a, b, smallest, temp; for(a = 0; a < numIntegers - 1; a++) { smallest = a;; numComp++; for(b = a+1; b < numIntegers; b++) { if(Integer.parseInt(list[b].toString()) < Integer.parseInt(list[smallest].toString())) { smallest = … |
Hi folks! I'm trying to wire simple code and so far I'm stuck on ActionListener. My program should contain (JMenu) Menu called SELECT and two options InnerFrame 1 and InnerFrame 2. To debug it I've started using System.EXIT , unfortunately I cant compile my program, I'm receiving an error: "java:48: … | |
hi all, Is there simple example out there where image is made by drawing lines on the panel ,and then print it on paper thank you denny | |
Here's what I have so far.. [CODE] // The "AddingPrefixes" class. import hsa.*; import javax.swing.JOptionPane; public class AddingPrefixes { static Console c; // The output console static char proc; static String prefix; static String word; static String sentences; private void title () { c.print (' ', 32); c.println ("Adding a … | |
When reading or writing to files, what should you have in a try-catch? And should you have a finally? Should I have everything in the try? Like.. maybe create a File variable to check if a file with that name exists etc and throw errors if they do. And then … | |
I have a Java Desktop Application I made and I am now on the process of deploying the application. I tried to use Java Web Start but came up with certain problems. My application is fully working when I start it locally or inside my IDE. But when I try … | |
Ok so i have a little problem which i cant seem to figure out this is what i have: The constructor loads my method that loads a list of employee to show in jTable, but when i place that method in my button it doesn't do anything This is my … | |
Can somebody please help me figure out where I went wrong? This is the problem and I have attached my code. Write a class with a main() method and two static methods. Your program should prompt the user for a single-digit integer. Your program should print out to the screen … | |
First the gui question Right now I have: [CODE]class ExportGUI extends JFrame implements ActionListener{ JTextField fileIN; //Text Field Bull //JLabel fInHelp;//Labels time JFileChooser BpsFile = new JFileChooser(); //File Chooser JCheckBox Check; JButton expButton; //reference button object JButton opnButton; JButton reset; JButton all; //Panels List<JCheckBox> checkList = new ArrayList<JCheckBox>(); JPanel inOut … | |
I'm create a program using java and MySql (jdbc) my problem where I'm start up the program in my customer computer , i must set up MySql program or not | |
Hello anyone, I have code: [CODE]java.lang.System.setProperty("sun.security.ssl.allowUnsafeRenegotiation", "true"); SSLContext ctx; ctx = SSLContext.getInstance("TLS"); ctx.init(new KeyManager[0],new TrustManager[] { new DefaultTrustManager() }, new SecureRandom()); SSLContext.setDefault(ctx); Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); URL url = new URL("https...."); HttpsURLConnection conn = (HttpsURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setDoInput(true); conn.setDoOutput(true); DataOutputStream output = new DataOutputStream( conn.getOutputStream()); output.writeBytes("data"); output.flush(); output.close();[/CODE] How do I edit … | |
Hello I am having issues with a script.. I am trying to have an array carry a bunch of vimeo codes. What I want to do is make it so that when someone clicks a button created by the array they are able to see a vimeo script open in … | |
Working on a simple banking program and it doesn't compile. Worked perfectly when everything was in main, then i was told to divide into methods( where everything went wrong ). The errors im getting are: C:\Users\DJ3\Desktop\School\Minilab5.java:30: illegal start of expression } ^ C:\Users\DJ3\Desktop\School\Minilab5.java:67: illegal start of type switch (userChoice) ^ … | |
Hello everyone, i thought of this question and i would greatly appreciate some pointers on it. I have 2 simple Java Projects which are GUI based. One writes some information to a text file. The other reads the text field and displays it on the GUI. My question: Is it … | |
Hello Friends, I need a hint to auto complete the combobox. I have two table SpeciesMaster and BreedMaster (Access Database) In the java code on the action Listener of the Species combo Box the breed details gets populated in the breed combobox. But now I want to filter the breed … | |
Is there any way that i can create a gui which contains an excel diagram sheet?not a jtable.. | |
[CODE]import java.util.Scanner; public class Sales { private String salespersonName; public Sales( String name ) { salespersonName = name; } public void setSalesPersonName( String name ) { salespersonName = name; } public String getSalesPersonName() { return salespersonName; } public void displayMessage() { System.out.printf( "Welcome to the sales calculator for\n%s\n\n", getSalesPersonName() ); … | |
[CODE]// The "StringReplacement" class. import java.awt.*; import hsa.Console; public class StringReplacement { static Console c; // The output console public static void main (String[] args) { c = new Console (); String word; String word2; String sentences; int i; c.print ("Enter the word to be replaced: "); word = c.readLine … | |
Hey, DW. I really need to know how to combine two images, into one image, but I don't want to draw it to the screen, and I don't want to save it to a file. It should look something like this [CODE] Image img1 = new ImageIcon("C:\\flying.png").getImage(); Image img2 = … | |
Write a program that launches 100 threads. [COLOR="Red"]Each thread adds 1 to a variable sum that initially zero. You need to pass sum by reference to each thread. In order to pass it by reference, define an integer wrapper object to hold sum[/COLOR]. Run the program with and without synchronization … | |
I am trying to store the numbers of a text file into a 2D array.. Here's the text file: 1 2 3 2 3 4 4 5 6 But i get the error: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2 at BankerAlg.main(BankerAlg.java:30) Process completed. Here's the code i made: [CODE] import … | |
I have created a window containing only one button(park1). All I need is a new dialog(with "OK" and "Cancel" buttons to open when I click on park1. Thanks in advance. [CODE] import java.awt.*; import java.awt.event.*; import javax.swing.*; class MyWin extends JFrame implements ActionListener { JButton park1; MyWin() { setSize(450, 500); … | |
new in programming and really need your help to code interfaces of applications using j2se | |
Hello forum, Vaironl here. I believe this questions has been answered before, but I cannot find the answer.. weird. I have a class which is called panel and extends a JPanel and a paint method. For some reason my Jlabel is not appearing, I read common painting problems, and tried … | |
I want to modify the below code to read the Polynomial Terms from a text file (vs. hard-coded values) Furthermore, read data from text file in the format: P1 = 3 5 1 -1 0 8 P2 = 5 6 2 -1 1 7 0 -4 etc... Name the values … | |
I am having trouble completing This hangman project. It mmost be done using model view controller pattern. Here is what i have so far //Header file declarations import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.FileInputStream; import java.io.IOException; import java.util.Scanner; //Class declaration class HangmanModel extends JFrame implements ActionListener { … | |
I am working on an application in which I select a color from a color selection dialog and click on a graphic shape to change its color. Everything is working fine, but now I would like to change the default arrow-shaped cursor to an eyedropper shape when I am in … | |
Hey I'm in an AP Computer Science class working on classes. We have been working on a project that is a date class that does certain things like setYear, getMonth, getDay, etc. I have gotten all of those to work, except for one. The last one is a boolean method … | |
My Java instructor yesterday gave us a sample test. One line that surprised me was something like [B] if ( m2++ < 10 ) { ………[/B] iow the first thing done is , in effect m2 = m2 + 1, an ASSIGNMENT. Whether the instructor ever actually discussed this in … | |
[B]hey guys: i put a question 2 days ago after having a problem with this equation and u guys helped me alot and solved it but i want to program it in java everything went well but gave me 2 errors here is the code and all information the code … |
The End.