Build A Calendar In BlueJ
May 25, 2014i 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.
View Repliesi 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.
View RepliesI am new to BlueJ. I have to add Javadocs every time I finish the program, but I see a folder named "doc" .
What's that folder ? Is it Javadocs?
I see :ToolsProject Documentation => regenerate??
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.
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,
I typed the following program using BlueJ
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);
[code]....
I am using blueJ as my java editor.
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 have to mirror an image in BlueJay (java)
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++)
[Code] ....
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;
[Code] .....
Driver:
*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?
how to build a GUI. I typed (not copy and paste) this code line by line to understand and get a meaning to each command. I ran into some errors while compiling and decided I would try to fix it. I ran into a problem there.....
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
[Code].....
I would like to set a specific time for a Calendar instance. My below code will set a time one minute ahead of the current time, and format it to ISO8601 standard.
Java Code:
Calendar reminderDate = Calendar.getInstance();
System.out.println(dateFormat.format(reminderDate.getTime()));
reminderDate.add(Calendar.MINUTE,1);
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
String finalReminderDate = sdf1.format(reminderDate.getTime()); mh_sh_highlight_all('java');
I now want to set another variable(deadlineDate), but to a specific time, say 5 minutes ahead. I would like to hardcode this in so I dont want it to change as a result of getting the instance of the Calendar(which sets it to the current time)
Essentially I am trying to regenerate the above code every minute and increment itself each cycle until it reaches the deadlineDate, which is a fixed datetime.
How can I do this?
He said that if you need something that Swing can't provide, like a bar graph, you build it. Now, being used to just writing a method that will open up a JFrame, how you would actually build graphics on your own. How in the world would that work? How would one write their own methods to make a window or to build a graph?
View Replies View Relatedhow to build GUI's with JFrame and I was firstly very confused as to when and what is always needed for any GUI in Java. How do I know everything I need for a GUI? Are there certain things every GUI will need by default?
Additionally below I have a code snippet of when this person used the "this" as an argument to a JButton and Im just really confused for when I can use it and when I can't.
public UIStuff(){
super("Multiple Button Events");
init();
} // end multi-button
[code]....
i am having problems with making it start. i have the buttons set but when i click on them they don't do anything.
mport java.awt.*;
import javax.swing.*;
public class Fan extends JFrame {
[Code].....
I have Georgian Calendar object
GregorianCalendar date = (GregorianCalendar)pageContext.getAttribute("datetime");
System.out.println("date :::: "+date);
It prints :
date :::: java.util.GregorianCalendar[time=1408045500000,areFieldsSet=true,
areAllFieldsSet=true,lenient=false,zone=sun.util.calendar.ZoneInfo[id="GMT+05:30",
offset=19800000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null],
firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2014,MONTH=7,
[Code] ....
I want month and year from this like August 2014. How can i do the same.
I've been looking online and I can find how to convert a Calendar datetype to Date, but what if I need a Date datatype to be Calendar?
I am try to count days and Date.getDay() has been deprecated.
import java.util.Calendar;
import java.util.GregorianCalendar;
public class CalendarCalc {
public CalendarCalc (){}
private static void printCalendarMonthYear (int month, int year)
[Code] .....
IDE is telling me this:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method printCalendarMonthYear(int, int) is undefined for the type CalendarDisplay
at CalendarDisplay.main(CalendarDisplay.java:46)
Btw, I have a main class. This is just the class responsible for doing calculations.
I'm having an issue with this little bit of conversion. I'm converting a string (_dateString) into a Calendar time. I am using DateFormat and SimpleDateFormat to accomplish this task. Everything seems to be working great, except for it figuring out whether it is AM or PM. According to SimpleDateFormat (Java Platform SE 7 ) I am using "aa" to get my AM or PM marker. How come in my output then, it believes it to be 4:45 am instead of 4:45 pm? Hour of Day should return the 24 hour clock, which should show 16 instead of 4. I have posted the output below my code.
Java Code:
import java.text.*;
import java.util.*;
public class Time{
static String _dateString = "08 Feb 2014, 4:45pm";
public static void main(String args[]){
Calendar cal=Calendar.getInstance();
[Code] ....
Output:
Java Code:
Today is Sat Feb 08 04:45:00 EST 2014
Year: 2014
Month: 1
Day of Month: 8
Day of Week: 7
Week Of Year: 6
Week of Month: 2
Hour: 4
Hour of Day: 4
Minute: 45
Second: 0
Millisecond: 0 mh_sh_highlight_all('java');
I am currently using notepad to create a Java program and using the command box to compile it and execute it and it has been working fine. I have the JDK version 7 so java.lang works which I know does not need to be imported. The Calendar method which should be recognized is not.
Here is the program. Cut this program and compile it in the command box. It will not recognize the Calendar method.
import java.util.*;
class Practice4_2
{
public static void main (String args[])
{
Calendar cal = Calender.getInstance();
Date.now = new Date();
[Code] ....
Here is my path if needed:
C:Program Files (x86)InteliCLS Client;
C:Program FilesInteliCLS Client;%SystemRoot%system32;
%SystemRoot%;%System Root%System32Wbem;%SYSTEMROOT%System32WindowsPowerShellv1.0;
[Code] ....
I have a field that initializes a Calendar object:
Java Code:
private Calendar zeroPointTime = zeroPointTime();
private Calendar zeroPointTime(){
int year = 2000;
int month = 0;
int date = 1;
int hourOfDay = 0;
int minute = 0;
Calendar calendarTime = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
calendarTime.set(year, month, date, hourOfDay, minute);
[Code] ....
But other times I need to reference what the value was initialized with, not offset values added to it with various function calls.
When I use add() will that modify zeroPointTime? If so, how can I add seconds to a Calendar object without altering its value?
I created a calendar program so when the user enters a day number and a year it would show the calendar for the year . My issue was that I could not get the numbers to line up neatly and how they should look . Also if its not to much trouble I would like to know how to turn this in to a loop .
import java.util.Scanner;
public class Calendar {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter a Year");
int Year = scanner.nextInt();
[Code] .....
I need to build the triangle like below. How to solve this using loops.
*
* *
* * *
* * * *
* * * * *
I wanted to build a calculator in java but I have a problem I wanted to when I type "plus" , go to This IF but don't go
import java.util.Scanner;
public class Session {
static String amal;
[code]....
I am trying to build an address book, and I started from what i know how to do.
public class Persona {
String nome;
String indirizzo;
int cellulare;
public Persona(String nom, String ind, int cel) {
nome = nom;
indirizzo = ind;
cellulare = cel;
[code].....
Now I would like the program to take a string I insert on command line (for example java Cerca"Robert Baratheon") and compare it to the nome field of every Persona in the address book.
I need a summary of the steps involve in building java application.I have my source code, already compiled but I don't know the next step to make it run on a particular device. I know of emulator but I need more information.
View Replies View Related