How To Make Robot Print Out Colons

May 1, 2014

I've tried making my robot print out colons but I just can't seem to. I tried doing

Java Code:
robot.keyPress(KeyEvent.VK_COLON); mh_sh_highlight_all('java');

and

ava Code:
robot.keyPress(KeyEvent.VK_SHIFT);
robot.keyPress(KeyEvent.VK_SEMICOLON); mh_sh_highlight_all('java');

And neither seem to work, in fact I can't seem to get any symbols typed out (I don't want to copy to clipboard and paste out) (yes, I do keyRelease as well -> I've tried a bunch of stuff)...

View Replies


ADVERTISEMENT

How To Make Resizable Screencapture Using Robot In Java

May 9, 2015

I am new to java. I am trying to make a simple screencapture and display program.

I am using robot class to capture a particular portion of the screen and display it in a separate frame.

However I need to be able to resize the area of screencapture. I searched but I dint find any solution wherein I can do so.

I am using this command for capturing the screen

But I couldn't find a way to make the rectangle re-sizable.

Java Code:

BufferedImage buff = robot.createScreenCapture(new Rectangle(0,0,1300,750)); // x-coord, y-coord, width, height mh_sh_highlight_all('java');

View Replies View Related

How To Make Print Employee Button To Print Info Of Other Class

Apr 12, 2014

Basically the class is supposed to have a static variable that keeps track of the number of companies (numberOfCompanies) that have been created and a static method that returns the value of this variable. I need to have a constructor and a method to addEmployee, a method to printCompany, and a toString method. The addEmployee method will check that there is only 1 salesperson, 2 designers, and 4 manufacturing persons at a time and will check that there are no more than 7 employees of the company.

The addEmployee method will return a String indicating what the error is (i.e. "There is already a sales person in this company") or a null if the employee was added. If attempting to name a third company, an error message will be shown. what i have so far but my print company mmethod returns null company class :in which i am obliged to use inputdialog because it says that it cannot return void when i use the showmeassage diaolog.

company class:

import java.util.ArrayList;
import javax.swing.JOptionPane;
public class Company {
private ArrayList<Employees> list ;
private static int numberOfCompanies;

[Code] ....

error message when print button is clicked:

Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: JOptionPane: parentComponent does not have a valid parent
at javax.swing.JOptionPane.createInternalFrame(Unknown Source)
at javax.swing.JOptionPane.showInternalOptionDialog(Unknown Source)
at javax.swing.JOptionPane.showInternalMessageDialog(Unknown Source)

[Code] ......

View Replies View Related

Drag And Drop Using Robot Class

Jun 4, 2014

Is it possible to do drag and drop using robot class instead of using TransferHandler class?

View Replies View Related

Coding A Robot To Follow A Line In Eclipse?

Mar 11, 2014

I have a serious issue with getting this robot to follow a line?

View Replies View Related

Program To Simulate Operation Of Simple Robot

Apr 26, 2015

Write a program to simulate the operation of a simple robot. The robot moves in four directions: Forward, backwawrd, left, and right. The job of the robot is to move items and place it in the right slots in each station. There are 8 stations plus the pickup station. Pick up station is the initial start where the robot picks the items. 8 items can be placed on each station. The nearest station must be filled before placing items on the next station. The items are marked with identification or serial numbers. The items with odd serial number go to the right and items with even number go to the eft. The last slot, number 7 is reserved for light items which are less than 80kg. The serial number is a five digit number, the MSB digit 5 indicates that the product must be placed in the fifth station which is keeping the product at 20 degree F.

View Replies View Related

Designing A Game That Simulates Roomba Robot Vacuum

Feb 14, 2014

I am designing a game that simulates a roomba robot vacuum and have most of the framework done. So I have random floating circles and the Roomba bot in the center. The boot is suppose to move with the arrow keys. However when i run the program and select the keys nothing happens. Here's my code.

import java.awt.*;
import java.awt.event.*;
import java.awt.geom.Ellipse2D;
import java.awt.Graphics;
import javax.swing.*;
public class Roomba extends JFrame implements ActionListener, KeyListener{
 
[Code] .....

View Replies View Related

Two Threads - One Will Print Odd And Other Will Print Even Numbers In Sequence

Jul 25, 2014

I want to create two thread one thread will print odd number and another thread will print even number. but the number should be in a sequence like

1 2 3 4 5 6 7 8 9 10

View Replies View Related

Make Shapes Besides Making Two Lines For X And Oval With White Smaller Oval Inside To Make O

May 8, 2014

We are making a tic tac toe game for my CS120 class and I am having trouble figuring out how to make our X's and O's. Is there a way to make shapes besides making two lines for an X and an oval with a white smaller oval inside to make an O? We have only learned the basics so far in class (i.e. events, inheritance, client-supplier, etc.)

These are our instructions:

Write a controller that controls the game. There is one human player (the X player) and the computer player (the O player). The name of the class must be TicTacToeController. In a sense, the controller is the game since the controller will 1) create a TicTacToeModel 2) create a TicTacToeView and 3) create a TicTacToeButton (you must write this class following the design pattern covered in class lectures), a label, and text field such that when the button is pushed, the player moves into the cell selected by the text field. After every player move, the computer moves into a randomly selected empty cell. When the game is over, a text message must be displayed somewhere on the screen the gives the status of the game. While you are free to change the appearance of the controller, the basic elements must be provided (a view of the game, a button, and a text field to enter the cell). A sample screenshot is displayed below.And this is the code i have thus far:

[import java.awt.*;
import javax.swing.JFrame;
public class TicTacToeView extends Rectangle
public TicTacToeView(int x, int y, int w, int h) {
super(50,60,w,h);
this.setBackground(Color.red);
JFrame win = new JFrame("Tic Tac Toe");
win.setBounds(10,10,w+100, h+100);
win.setLayout(null);
win.setVisible(true);
win.setBackground(Color.gray);

[code]....

View Replies View Related

How To Make Palindrome

Aug 16, 2014

I want to ask how to make Palindrome in Java with 2 methods //Output is Like this

Input a word
Hey
Not a Palindrome
Reverse
yeH

View Replies View Related

Make Own Color To Use With Awt

Aug 22, 2014

I am stuck. I was trying to make my own Color to use with awt.

I used the statement :

public static final Color purple = new Color(255,0,255);

When I try to use Color.purple it says it cannot reference purple.

View Replies View Related

How To Make And Use A List

Nov 3, 2014

I first learned how to program with BYOB. In BYOB there were variables and lists. Variables worked the same as Java and lists were groups of variables. To create a list, I would give it a name. I could then add variables to this list as items throughout the program. Here's an example of what a list would look like:

[[List]]
item 1: Hello
item 2: world

I could then call upon item 1 or item 2 and delete them if needed. In Java, I want to have 3 lists of variables into which I put user input as variables. The code would look something like the following: (stuff with "//" at the end is detailing what I want to do, not actual working code)

import java.util.*;
public class Archives {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);

[code]....

View Replies View Related

How To Make Loop End

Feb 3, 2014

I do not know how to make the loop end. I think there is an issue with my second and thrid algorithms..Also its a commission calculator

--- Update ---

//Start Program
package commission;
import java.util.Scanner;
public class Commission
{

private static boolean saleTargetrange;

[code]....

View Replies View Related

How To Make Square Which Is Filled With (dot)

Oct 17, 2014

Do I want to make something like this:

*****
*.....*
*.....*
*.....*
*****

I am stuck, I have made a code that creates this and don't know how to complete it.

*****
* *
* *
* *
*****

Code:

class Main {
public static void main( String args[] ) {
System.out.print("#Enter number of stars :");
int stars = BIO.getInt();

[Code] ....

View Replies View Related

Using Text File To Make GUI?

Apr 16, 2015

I am currently in the progress of making a GUI for a project. I am trying to make a maze and I need it displayed in a GUI. So, I thought I would be able to do that with a text file that I created. The code I have for it so far runs and compiles but it is not displaying my text file as a GUI, even though it reads the file. All I get are a bunch of green rectangles. I am using Netbeans to code this

package rectangles;
import java.awt.Color;
import java.awt.Graphics;//this will draw the maze
import java.awt.Graphics2D;//
import java.io.BufferedReader;
import java.io.FileNotFoundException;//handles file

[code]....

View Replies View Related

Why Add Static To Make A Constant

Oct 30, 2014

public static final String NAME="JAVATAR";

"final" makes sure the constant has the same value and prevents it from being changed. So why add "static" to make it a constant. I figured the reason a few weeks back but don't remember it now.

View Replies View Related

Make A Pause Between Every Loop

Feb 18, 2015

I've been learning Java in school for lika a year now. Our teacher wanted us to make a game called "Game of Life" .Now it's not very optimized because the only type of GUI we know how to make it with JButtons so if I want a 100x100 grid that means the program has to load 10000 buttons and change text and color on them which I can imagen cause lags and so on but if we ignore that lagg our teacher wanted us to make it loop-able and well I kinda succeeded but the only problem is that I can't get it to wait between every loop so if I tell the program to loop 100 times, the program processes that and that takes forever and then updates the board and sometimes it takes forever and sometimes you cant even see the "cells" moving. Is it possible to get my program to loop and if so how? Here is the code:

//------------------------------------------------------------------------------------------------------------------------
// Hamta standardpaket
//------------------------------------------------------------------------------------------------------------------------
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

[code]....

View Replies View Related

Make A Switch With A String

Jan 9, 2015

I needed to make a switch with a string ,but eclipse told met there was an error and that the fix was to switch to 1.7 compliant. I did so and now when i run my program errors come back.

Here are the errors :

Exception in thread "main" java.lang.UnsupportedClassVersionerror: start : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)

[code]....

View Replies View Related

How To Make JPanels Slide

Sep 25, 2014

I want to know how can I make a JPanel slide to to another JPanel (Slowly move to the next). I've made multiple JPanels so when I click on next it will take me to the next panel. Now I just need to add a nice transition to make my program look nicer. Is there an easy way to do it? or any way is fine I just want to add a transition ....

View Replies View Related

Trying To Make The Image Move

Oct 27, 2014

I am having trouble making my image move to a certain position in a certain amount of time which is set inside a text file. I was wondering what I'm doing wrong and what I'm missing.

import java.io.*;
import java.util.*;
import java.io.FileReader;
public class Animator {
EZImage HP;

[code]....

View Replies View Related

How To Make Smoother Movement

Jan 23, 2014

First, I have a figure that moves around the screen. It uses keylisteners and just subtracts or adds pixels. However, I notice the movement is not smooth at all. It is very rigid and laggy movement. How can I make it smoother movement?

Second, you get three lives in the game. The lives are subtracting correctly, but I want the game to say "GAME OVER" on a dialog box. How would I get this to happen? My JFrame and my life int are in separate classes. I know I should use an if statement, saying if lives are at or less than zero, open the box, but how do I open the box?

Third, I want to display the time on the screen. I have a swing timer, but how do I put it on the screen? DrawString is not working for me.

Fourth, I want to set an icon for the game, the code is running, but not doing anything.

Java Code: frame.setIconImage(Toolkit.getDefaultToolkit().getImage("/Users/MW/Downloads/petericon.jpg")); mh_sh_highlight_all('java');

View Replies View Related

How To Make The Score Appear In The JFrame

Mar 28, 2014

I was thinking to make a game where a button is appearing in random spots and you have to click it, and once you click it you're score goes up. But I don't know how to make the score appear in the JFrame, and I want the score to update everytime the Button is Clicked.

Here is the code:

Java Code:

package clickmegame;
import java.awt.Dimension;
import java.util.Random;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class ClickMeGame {
public static void main(String[] args) {

[Code]...

View Replies View Related

How To Make Pseudo Animation

Jan 24, 2014

I have an image that moves with arrow keys, and I want to make it appear to be moving. So, I made that image, and then another with the legs moved, to give the illusion of motion. I added it to an event

Java Code:

if (k == KeyEvent.VK_RIGHT) {
image1 = image6;
peterx = peterx + 10;
resetIt();
repaint();
} mh_sh_highlight_all('java');

But it only serves to change it once. How would I make it revert to the original frame once it is converted to the second frame (image 6)? I tried a gif but to no avail?

View Replies View Related

How To Make Calculator Using Stacks

Feb 5, 2014

I got to make a java code for my class. I must make a calculator using stacks. I have a code but i got some mistakes. Here is the code

Java Code:

package stackscalc;
import java.util.Scanner;
import java.util.Stack;
import java.util.EmptyStackException;
class Arithmetic {
int length;
Stack stk;
String exp,

[Code] .....

View Replies View Related

Make A Program With Two Buttons

Feb 10, 2014

I'm trying to make a program with two buttons... when you click the first a label shows a red square when you click the second it shows a green square... right now i have the imageicons as a comment because when they weren't a comment and i ran the program i saw nothing... the same thing happens when i add label2 to panel3.

Java Code:

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class GUI3{
public static void main(String[] args){
//frame
JFrame frame = new JFrame("Test");

[code]...

View Replies View Related

How To Make Sum Of Variables In A Loop

Aug 13, 2014

I've looped a method 14 times, each time it focuses on a different person and how many oranges he/she has eaten. I now want to calculate the total amount of oranges eaten and exactly how many oranges are eaten on average, how can I do that?? the amount of oranges eaten is variable, they are determined by what number the user types in.

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved