Draw Sequential Diagram Using Java
May 14, 2014draw a sequential diagram using java.with out using any other tool or plugins.
View Repliesdraw a sequential diagram using java.with out using any other tool or plugins.
View RepliesI'm having trouble doing out a class diagram for an app I'm trying to create.The app is a quiz app for students to use in their study. The following objects I have to put in the class diagram are:
Basic Questions attributes:
questionText
correctAnswer
mark (representing the mark awarded for a correct answer)
Answer (representing the answer entered by the user).
Multiple choice question attributes:
questionText
correctAnswer
mark (representing the mark awarded for a correct answer)
option a, option b and option c (representing each of the possible answer)
answer (representing the answer chosen by the user)
Essay Question attributes:
questionText
correctAnswer
mark (representing the mark awarded for a correct answer)
answer (representing the text entered by the user)
maxWordCount (representing the maximum word count for the essay)
Picture Question attributes:
questionText
correctAnswer
answer (representing the text entered by the user)
imageName (representing the image to be displayed with the question)
I want to plot a scatter diagram and I need to do this as soon as possible.
The graph is to make use of JComponent only.
The diagram title should show the Title: Graph of y on x
The scattergram should show points (x,y) of Npoints.
The diagram should calculate and draw a "line of best fit" for the data.
The diagram should also state the equation for the line of best fit.
I have installed eclipse and is it possible to get a code to run this?
If I have a function for example y=x^2
How can I draw the curve?
Righto, so I've crafted a binary search and a sequential search. The sequential search works perfectly fine.
However; my binary search doesn't. If I enter in incorrect data, it tells me the data I entered was incorrect. But if I enter in correct data, my sequential search tells me my datas correct, but binary search tells me I'm still incorrect. Here's my binary search + the test program.
public class ValidatorWilson
{
int[] accountNumbers = {5658845, 4520125, 7895122, 8777541, 8451277, 1302850,
8080152, 4562555, 5552012, 5050552, 7825877, 1250255,
1005231, 6545231, 3852085, 7576651, 7881200, 4581002};
public boolean partTwo(int numberCheck)
{
if (accountNumbers.length == 0)
[Code] ....
I need to write a program that, when a button is pressed, will add the user input to a table AND write it to a sequential data file. I have everything done accept for how to write the data sequentially(all input data on the same line in the file). The following is part of the code:
private void submitButtonActionPerformed(java.awt.event.ActionEvent evt) {
DefaultTableModel dtm = (DefaultTableModel)jTable1.getModel();
dtm.addRow(new Object[]{donorName.getText(),charityName.getText(),donationAmmount.getText()});
//Adds user input to the table
try
{
FileWriter writer = new FileWriter("FundraisingInformation.txt",true);//Creates file or adds to it
BufferedWriter bw = new BufferedWriter(writer);
[code].....
I would need the file output to be in the following format:
donorName charityName donationAmmount
As I said, using the .write(bw) i know how to make it look like:
donorName
charityName
donationAmmount
How to get my program to display a piece of text (upside down) on the first button press, and then display it right-side up on the second button press. I've looked all over the internet and I can't seem to find a example that fits my situation.
Here is the code:
package org.CIS407.Lab10;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class JUpsideDown extends JFrame
implements ActionListener
[Code] ....
Reading a sequential flat file (which is working) but now I need to add code to update the status flag (setting it to ‘Y’ position(7,1)) before I close the file and not sure how without defining the fields.
try
{
tFile = getTFileName();
System.out.println("File Name: " +tFile);
ukarf = new ZFile(tFile, options);
while(!EOF) {
int bytesRead = ukarf.read(buffer);
System.out.println("Record read: " +new String(buffer,0,9,"IBM-1047"));
if(bytesRead == -1)
[code]....
I just trying to find the most efficient way to do this. I read in a csv file into a linked list and then I split the linked list into sections based on category for each element. Of course I used an array to split each element of the list. However I can do the sequential search by either ID and Name by using hashmap and making the key = name + ID and then doing key.contains(charSequence);. However I feel like this is inefficient and I would like to use the linked list instead of a hashmap which could be done by splitting the user input and used for method overloading by passing an int in one and a string in another. I feel like this approach is a little more redundant and maybe their is a better approach for searching for id and name. Below is an example of the elements in a linked list.
note: their are more elements than this.
element 1
name: George
address: 4410 something dr.
phone number: 978-888-6666
id: 43
element 2
name: Karla
address: 339 something dr.
phone number: 334-338-6556
id: 23
//compiler error I'm receiving
J:CS3Student Folder Review Lab #2APlusImage.java:41: error: cannot find symbol
xcor.add(read.nexInt());
[Code].....
I have a JPanel embedded in a JScrollPane. I draw in the JPanel, using the paint() method. I have to draw some shapes that can go far in the y direction, that's why I put my JPanel in a scroll pane, in order to scroll down to be able to discover the shapes down. But even though I put my JPanel in a JScrollPane, it soon blocks in the y direction and does not show the shapes far in the y direction.
Note: I used a GridBagConstraints which is correctly set, with its fill attribute etc.
So I also am working on this problem. My frame does print each new rectangle; however, it is printed each time from the top left corner, and the bottom right is where I click.
Here is my RectangleComponent:
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.Shape;
import java.util.ArrayList;
import javax.swing.JComponent;
public class RectangleComponent extends JComponent
[Code] ....
So I drew a menu in DrawingPanel extends JPanel, that gets user input of number of players...etc. I also have a boolean, when true, the board is drawn, but apparently, right when I run, the boolean is checked, returns false and so board isn't drawn at all. When the user finishes input, the boolean becomes true, but the board doesn't get drawn. So my question is, how do I draw something not immediately when the program is ran?
View Replies View Relatedimport javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
public class Game extends JPanel implements ActionListener, KeyListener{
Timer t = new Timer(5,this);
double x = 0, y = 0, velx = 0, vely = 0;
[Code] .....
So why doesn't it work and what about the second dot.... ?
I 'm trying to draw a button by resizing a simple button background image to fit the size of the text. Everything works well except for the actual drawing of the string. The y value that I give the Graphics object designates the baseline, however I would like to draw the the string above the y. So that the image below doesn't happen.
I gave the graphics object the y of the bottom of the "P" and would instead like to give it the value of the bottom of the "y". Is there a way to do that by reading the String's bounds or something, or is there a way to get the Graphics object to use the passed y value as the definite bottom of the String?
I'm doing a exercise for dragging mouse to draw a line. I found a code to do this, but I don't know something in the code. example array Shape in the code.
import java.awt.AlphaComposite;
import java.awt.BasicStroke;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Graphics;
[Code] ....
I've tried multiple things but I can't seem to figure out how to get my JButton over the background graphics. On lines 104-108 I create the JButton I need to put on the screen, though I have no clue how to draw it. How I can paint over this background and have my button stay there?
public static final int WIDTH = 1024;
public static final int HEIGHT = 640;
private Thread thread;
private boolean running;
private BufferedImage image;
private Graphics2D g;
[Code] .....
I'm not looking for answers, well I am.. but not just straight given to me. I'm trying to learn but for this program I'm not even sure where to start. One step looks like this:
O *******
/| * *
/ * *
************
It must increase by a constant named STEPS. They ascend from left and go up right.
I'm just gonna start asking some questions I guess. Before I do anything I wanted to know whether I should have the stick man on the step drawn out with print and println statements or try to have him drawn with a loop as well? I'm not sure if my teacher wants everything drawn by characters with loops for each character, or if I can do print statements and draw the stick figure plus some stars and have a loop for multiple characters at once.
I've been trying to draw a panel on a frame with simple drawString drawRect and oval but when i run it the frame shows up with the exit on close stuff but nothing will show inside . this is my code :
import java.awt.Graphics;
import javax.swing.JPanel;
import javax.swing.JFrame;
class Draw extends JPanel{
public void paintcomponents(Graphics g){
super.paintComponent(g);
g.drawLine(10,15,20,30);
[Code] .....
I'm not sure what's wrong , probably something to do from this pc ? since in the lab work at uni it worked fine .
So currently I'm trying to learn how to draw a square with asterisks based on the input I give for it's sideLength.
So if I have a Square(5) it should draw a 5x5 looking like this:
*****
*****
*****
*****
*****
but then in the main method, it should draw multiple squares of given sizes, so say 5, 6, and 7. Making a square for each of the given numbers. This is what I currently have so far ....
class Square {
int sideLength; Square( int size ) {
sideLength= size;
} int getArea() {
return sideLength * sideLength;
[Code] ....
I extracted columns from database and made calculations inside while loop. I know i need to make array to get from it coordinates for points. I want to draw them in interface created in another class but i have black hole and don't know how to get datas from while loop to array which is below.
View Replies View RelatedI have been trying to add a draw system to my code so far once all the boxes have been taken it does not tell the player its a draw game over. I have tried and deleted some code but I have commented some stuff that did'nt work at the bottom and also the X's and O's can be replaced in the same spaces?
import java.util.*;
//import for scanner
public class NoughtsAndCrosses {
public static int row,col; //integer for rows and columns
public static Scanner scan = new Scanner(System.in); //Scans the program
public static char[][] board = new char [4][4]; //Characters for the board set out 4/4
[Code] .....
I'm currently trying to do a diamond using Polygon. I have done this so far. It is not drawing a diamond.
import java.applet.Applet;
import java.awt.Graphics;
public class Diamond extends Applet {
int[] a = {-30, 100 , 30, 100};
int[] b = {100, 40, 100, -40};
public void init()
{
}
public void paint(Graphics g)
{
g.drawPolygon(a, b, 4);
}
I have few values for X and Y axis from the Oracle DB table. SO is there any java technology available to display the values in the form of graph with the valuesfrom the table along X and Y axis and represent it in any form of graph , which we could chose.
View Replies View RelatedI currently have the code set up to iterate through objects and keep track of them but how do I do the same and draw the objects on the panel window? I'm confused on what to do and how to start it.
Here's the code I have so far, the 'Car' which I want to draw extends to another class which extends to GameObject. I currently have a 'draw()' method under the 'Car' class but nothing in the 'draw()' method yet. From what I understand i'm suppose to have a 'draw()' method under 'GameObjects' class also?
public class MapView extends JPanel implements IObserver, ActionListener{
JPanel myPanel;
private Timer timer = new Timer(5, this);
int x = 0;
int moveX = 2;
public MapView(){
super.setBorder(BorderFactory.createTitledBorder("Map:"));
[code]....
Mostly I don't understand how to go through the iterator again to paint the objects. Wouldn't I need to put another iterator under 'paintComponent()' or can it be done under 'update()' ?
how to get some shapes from the GameObjects onto my panel.
I have this piece of code, i want to insert a text inside my shape.
import javax.swing.SwingUtilities;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.BorderFactory;
import java.awt.Color;
[Code] ....