I have the following code, but it is missing a little bit. My instructor gave me a hint. He said that i have to use the setValue() and getValue() methods, but i'm still confused..
This code only return a black image with the same compositions as the image I want to mirror.
public Image mirror()
{
Image mirrorImage;
mirrorImage = new Image(foto.getWidth(), foto.getHeight(), "spejling");
for(int i = 0; i < foto.getWidth(); i++)
I am trying to calculate factorials using BlueJ. All of my factorials calculate correctly, I am just having an issue with something the instructor asked of us. She asked us to force the loop to stop when the user inputs "Calculate the factorial of 0", and not give any print.
So far I have my for loop with the correct conditions, I am just really confused as to how to make an if statement to stop the code when the input is 0.
i have a problem, i need build a calender in BlueJ. The program need to found if I put this one year have to give me the full schedule but only the first semester.
the system I am using is blue jay and java. my problem is that I have this error message pop up whenever I try to compile any of my 6 classes. Three of the classes are cities, 3 others are shops, and the final one is a inventory called Player. The following is the error code that appears when I try to compile class THshopB or class CityB.
method run in class CityB cannot be applied to given types;required: Player; found: no arguments; reason: actual and formal argument lists differ in length
A similar error occurs for the rest of my City and THshop classes,except it replaces the class CityB with CityA and occurs in class THshopA, replaces CityB with CityC when occurring in class THshopC.The public methods of CityB and THshopB are shown below, as I believe that something is wrong with the public method of one or the other. I have the code [CItyB.run();}] inside of class THshopB, and run is the part that gets the red highlight error described above.THshopB public method
[ public static void shop(Player inventory){ CityB.run();}] CityB public method [ public static void run(Player inventory){ THshopB.shop(inventory);]
All of my THshop classes are written in the same format, and all of my City classes are written in the same format,
import static java.lang.System.out; import java.util.Scanner; import javax.swing.JFrame; public class Main { public static void main (String args[]) { Scanner read = new Scanner (System.in); out.print ("> "); double num = read.nextDouble(); out.println (num); } }
When I compile the code it gives me no errors; however when I run the program and write a floating point number it gives me the following message:
java.util.InputMismatchException: null (in java.util.Scanner)
I used to use an online compiler and the nextDouble() method worked perfectly there.
I've been doing a course with a heavy focus on applets and AWT using BlueJ. I've branched out and learn to convert my applets to applications. I can successfully use frames to do similar things to applets (in BlueJ's applet viewer) but I can not seem to run more than application at a time (unlike applets where I could run several at the same time).
Below is a simple Hello World program I wrote. When I re-run main() it closes the original and starts again. (I'm aiming to explore the java.net.* libraries and for testing would like to use more than one frame at a time which can communicate to each over via sockets).
import java.awt.*; import java.awt.event.*; public class HelloWorld extends Frame implements WindowListener { public static void main (String[] args) { HelloWorld app = new HelloWorld(); app.setSize(500,500);
If I have a method that creates a new variable (the name of which is a string argument for the method). Can I get that variable to appear in the workspace in the variables pane?
So instead of just using return to output the variable how do I get in that variables pane?
I'm trying to generate a multicoloured brick wall as part of an assignment using BlueJ.
According to the instructions we've been given, once the wall is set up and we invoke the draw() method, if we invoke the toggleMultiColoured method the bricks will go from being all read to a mix of 6 different colours...
...When I invoke the toggleMultiColoured method, however, the wall I generate is still red.
Here's the source code for the BrickWall class I wrote:
Java Code:
public class BrickWall { private int bWidth; private int bHeight; private int numRows; private int rowLength; private ArrayList<String> colors; private ArrayList<Rectangle> bricks;
*initiating theGrid[][]* public Zhang() { con.setLayout(new FlowLayout()); for (int xDimension = 0; xDimension<theGrid.length; xDimension++)
[Code] ....
All I'm getting as a blank screen and I've searched for what to put into object oriented code to make the image show up how to program using 2d arrays. I don't get any error messages (which is good I suppose) but how to make the image show up because I have stuff under the graphics and draw methods, did I do something wrong where initializing the array?
I'm relatively new to java and to image processing ... What I've done so far is make a simple application which opens the webcam and can take and save a picture. Ive then loaded the image pixel data into a 2d array. How then do I do what is known as 'fast fourier transform' on it from here?
I have been trying to rotate an image on a certain degree, and still remain on the same position. I have tried g.rotate, but it just rotate around a center, and it does not keep the same position as before.
I am coding for the first time using the simplified BlueJ platform. I am trying to write a simple conversion program from cm to inches and inches to cm.
Here is my code so far (I also have the textIO file linked to it):
public class UnitConverter { public static void main(String[] args){ int inchesTocentimetres, centimetresToinches, exitApplication; int choice; double result;
Sir, I'am new to Swing Programming. I have to create an application where an image is displayed on one Label. The same image has to be split in parts and stored in database pert wise. Later the user has to retrieve the entire image by viewing a small part of the image. I have already displayed the full image on the Label, now i don't know how to split the image and store it part wise in the database.
I have a GUI with several buttons and I'm using NetBeans GUI Builder to do. At the click of one of these I would like for it to open another frame containing a picture. So I associate a listener (actionPerformed) the button and when clicked it opens actually post the new frame.
In the new frame I waxed a JLabel and then I associate the image of the label. I saw that to do that NetBeans generates this code:
My problem is that the picture is overwritten several times during the execution of the program is not changed yet in the frame. That is, in the new frame is always displayed an old version of the image.
I have an image that is created every time I click on the button (it always has the same name and same path). Basically I have a generic tree on which I perform the operations (add, remove, etc..). When I click on the button I call a method that generates the image of the tree (using Graphviz). So I have one image that changes over the time...
How can I do so that the image is always up to date?
The Code:
package View; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JLabel; public class AlberoIpotesi extends javax.swing.JFrame {
how to display a jpg image on a through a Jlabel. I am sure it is a simple error but I am still new to GUI's. line 31 to 35 you can see the ImageIcon and file wrapped in the JLabel. I verified its in the correct location and file name, but usually fails (i thought) when it is not correct.
I have an applet coded to recieve an image and upon mouse press i wish it to be cropped. For some reason its not implementing, I just think my brain is no longer doing what i think it should be or something, along those lines.
I have been on java applets and it's been fun but I'm stucked with painting a ladybug image on applet using "getImage ( getCodeBase(), "Images/ ladybug.gif") to load the image. It runs but the appletviewer is blank. My applets are not embedded in the web. I just type the codes in eclipse and click the 'run' button.I think the problem is that java is not finding the image in the directory I specified. Please where am I supposed to save the ladybug image so that java can find it on my system whenever I supply the path.
I already done my program with images on it but when i convert it to exe , the images is not appearing.
Usually my images are located at documents netbeansprojectprojectimage.jpg
When i run the code on netbeans the images are appearing but when i convert it to exe or jar file run on a computer without netbeans.. images is not appearing ...
I stored an image into MySQL database using swings and hibernate but I am struggling to retrieve that image from MySQL database and display same image in the jTable cell and same as on jLabel whatever I retrieve from the database using swings and hibernate .
Working on an assignment for a class: Create a DESKTOP application that allows you to open an image file and enables you to zoom in on or out from an image. I believe all I need is too create an open button to open the actual image file, instead of the html link, this code is an example that the teacher provided.My current code: