Making Window Not Resizable

Oct 9, 2014

How would i go about making this NOT resizable?

If I do try to do ChatFrame.setResizable(false); it gives me this error:

Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problem:
Cannot make a static reference to the non-static method setResizable(boolean) from the type Frame

at com.ui.ChatFrame.<init>(ChatFrame.java:37)
at com.ui.ChatFrame$5.run(ChatFrame.java:403)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)

[Code] ....

Here is the code:

package com.ui;
import com.socket.History;
import com.socket.Message;
import com.socket.SocketClient;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;

[Code] ....

View Replies


ADVERTISEMENT

Opening A New Window In GUI And Making Another Event Work Together

Oct 17, 2014

My program has just "File" and "Help" in the menubar when "File" is clicked, there is an exit item that closes when clicked.i want the "About" item in "Help" to open a new window, what's wrong with my code?here is it:

import javax.swing.JFrame;
import javax.swing.JDialog;
import javax.swing.JPanel;
import java.awt.FlowLayout;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JTextField;
import javax.swing.JLabel;

[code]....

View Replies View Related

Making A Window For Java Text Based Game

Jan 10, 2015

So, Iv'e been trying to make a simple Text Based RPG with Java, and it is going quite well, and my friends want to play it too but they aren't very tech savvy, so it's hard to tell them to get an IDE or use the CMD, so I wanted to know if there was a way to make my text-based game into a window, like using JFrame or something. All i need is a window that displays the text, and a bar on the bottom that lets the user input what they want (Kind of like a CMD).

I want it sort of like this window: This Pic

View Replies View Related

How To Make Resizable House

Aug 3, 2014

I am currently trying to make a method to make a resizable house. While I can certainly resize the size of every object in the house, for example a window, door, or roof, that has proven very difficult due to balancing issues(having a big window can overshadow the entire house). What I would like to do is resize all objects together at the same time so everything is spaced out accordingly. I imagine I will need some sort of mathematical formula to do so(which I am horrible at). Here is the method for drawing the house and the implementation of it.

Java Code:

public void drawhouse(double sizeH, double sizeW,double xpos, double ypos) {
GRect body = new GRect(sizeH, sizeW); // w/2 h/3
body.setFilled(true);
body.setFillColor(Color.GRAY);
add(body, xpos, ypos);

[Code] ....

Ideally I wish I could just save all these objects into one (like creating a GObject and just calling that when I would want to edit it, but that has proven unsuccessful)....

View Replies View Related

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

JavaFX 2.0 :: Manipulating Several Windows (Window Inside Window)

Apr 6, 2015

I am new to javafx I start using it instead of swing i used the scene builder for my forms the problem i faced i don't know how to have main screen with menu bar at top and depending the select from the menu it will open other windows and those window must be inside my window just like for example netbeans.

I don't need to open new window in separate i need all windows inside my main window and controlling over them minimize maximize perhaps.

View Replies View Related

JSP :: Making Sessions To Not Expire?

May 30, 2006

how this is done using session.setMaxInactiveInterval(); at first, i did not set anything but it expires anyway.so i'm trying not to let the session expire.session.setMaxInactiveInterval(0) does not work.

View Replies View Related

Making Import / Export Of XML

Sep 17, 2014

I'm making an import/export of xml - I have the import of xml sorted I'm just trying to finish off the export. My export class is called XmlWriter.java. Inside the class I have an updateFile method to update an xml file as such:

public void updateFile(Environment environment,Document doc)
{
// code
}

I then in my main method have

public static void main(String argv[]){
 //declare new object of class
XmlWriter xmlWriter = new XmlWriter();
//test testUpdate method
// xmlWriter.testUpdate();
 Environment environment = ;

[code]....

I don't know what to make my variables equal to - eclipse keeps trying to use null but obviously that won't work. The Environment is another class that just contains getters and setters for the 3 different databases (that are in the xml file) and the getter/setter for the environment ID (also in xml file).

View Replies View Related

Making Exe File With IntelliJ

Jan 10, 2014

How can I make an .exe file for my java project that will work on every computer?

I have a jar file, but the project can not work without installed IntellyJ or other development environment on that computer, i.e. it doesn't work only with installed java runtime.

What can I do to make an .exe file for my java project?

View Replies View Related

JSP :: Making A Request To A Servlet More Than Once

Sep 29, 2014

I have a jsp with an img tag whose src is set to request a servlet to display a chart. This is called from another jsp form where user can select various filters. The first time the request is made all works great. but if the user changes the filter settings and and makes the servlet request a second time the chart stays the same. I have verified the new filter values are being set but the servlet is only being called on the initial request.at the head or called servlet I have(I also call a jquery empty on the div that holds the chart between requests. at the moment it just displays the former chart). It is like it is using cache:

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setHeader( "Pragma", "no-cache" );
response.setHeader( "Cache-Control", "no-cache" );
response.setDateHeader( "Expires", 0 );

View Replies View Related

Making Pie Chart For Values That The Row Contain

Mar 9, 2014

I use JTable and JScrollpane in my java application, and I would like for every selected row in the scroll pane, the pie chart to be made for the values in % that the row contain.

View Replies View Related

Making Home Inventory

Jan 22, 2014

I'm going to make Dekstop Based Home Inventory, do you have a tutorial for it ?

View Replies View Related

Making A Rain Histogram

Mar 10, 2014

I prompted the user to enter inches of rainfall for seven days and stored them in an array. Now, I am trying to display a histogram of this data using a nested loop, but for each inch, I have to display a * like this:

Rainfall Histogram:
****
***
**
******
********
**********
**

The only way I know how to display a number of *s according to user input is by an if statement. I copied and pasted from a similar class assignment I did, so what I have so far is pretty messy and nonsensical:

static char DetermineRainfall(int inches)

System.out.println("Histogram");
//char inches;
for(inches = 0; inches < 7; inches++)
{
for(int j = 0; j < 1; j++)
{
if (rainamount > .9 && rainamount <= 1)
inches = '*';
return inches;
}
}

View Replies View Related

Making Applet Compatible With OSX

Nov 28, 2014

I am trying to run a Java applet (.jnlp) file through OSX. The purpose of the applet is to upload files to an SQL server. When I try to run the applet, I get an "Unable to launch the application" error because "No application resources are specified for this platform" After some digging , we noticed there are only resource instructions for "Windows".

Would there be any way possible to make this compatible in an OSX environment through a few alterations to the code, or would this be an issue that the original developers would have to resolve?

Here is the specific code pointing to the Windows Resources:

<resources os="Windows" arch="amd64">
<j2se version='1.6+' initial-heap-size="64m" max-heap-size="512m"/>
<jar href='http://192.168.1.140:7001/MagicInfo/uploader/uploader.jar' main='true' />
<jar href='http://192.168.1.140:7001/MagicInfo/uploader/lib/jnlp.jar' download="eager" />
<jar href='http://192.168.1.140:7001/MagicInfo/uploader/lib/transform.jar' download="eager" />

[Code] ....

View Replies View Related

Making Counter AI For Connect 4 Game?

Apr 28, 2015

I am a student in an intro to computer science class working on my final project. This is essentially a game of connect 4, but only requiring 3-in-a-row for victory. We were given the base game and a sample file to work with to make an AI that beats our professor's ai in the base game. Here is the base game

package cs110.project3;
 import javafx.application.Application;
import javafx.application.Platform;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;

[code].....

View Replies View Related

Making Squares Of Numbers Without Multiplication?

Oct 22, 2014

so for my computer science class, we have the following problem:

In your documentation be sure to say which loop you thought was easier to implement for this program and why Write a program that produces the following outputs. The first line of output must be written using a For-Loop. The second, using a While-Loop and the third using a Do-Loop.

You look at the program and smile because you see that the series is just the numbers 1-10 squared...just one line is in reverse order. No problem! As you start typing you discover that the number 8 key on your keyboard is not working. For this program you are unable to use the multiplication key

So, back to the drawing board. By staring at the sequence a light comes on and you are able to quickly finish this program WITHOUT using mulitiplication (or the Math class/ solve with arithmetic operators +, - or / ) .

Sample output:

For Loop
1 4 9 16 25 36 49 64 81 100

While Loop
100 81 64 49 36 25 16 9 4 1

Do While Loop
1 4 9 16 25 36 49 64 81 100

I have the "for" done, but I did it with a "for" in the beginning but then had a multitude of nested "if" loops so that I could do 7*7=7+7+7+7+7+7+7

View Replies View Related

Making Integers Have Limited Numbers?

Aug 14, 2014

I want users to input their phone Number But I want to make sure it is a phone number so they don't just do 1 and then leave it.

public static void main(String[] args) {
// Create the Scanner
Scanner in = new Scanner(System.in);
// Create the Variables
int phone;
if(phone > 100000000000 || phone < 100000000000) {
System.err.println("Error");
}

By the Way there are 12 digits in the if statement so that is 11 0's. Because all phone numbers are 12 digits.But when I run it, it comes up with an error saying The literal 100000000000000000000 of type int is out of range.I don't know how to make it so that the int has a limited number.

View Replies View Related

Making A Loop Go A Certain Amount Of Times?

Jun 14, 2014

I am having is not being able to print out the diamond the amount of times the user enters (for example, when it asks how many diamonds, I enter a 2 and only one diamond comes out.)

import java.util.Scanner;
public class Pattern5
{
public static void main(String[] args)
{
// For this pattern program, ask the user how many diamonds
// she would like to print to the screen. The following pattern is one diamond.

[code]...

View Replies View Related

Making Plus Sign To Add Two Numbers In Java

Mar 7, 2015

I am having a bit of trouble making the '+' add two numbers in java. For example:

When the user enters " + 4 5 " I want it to come out as " 4.00e+00 + 5.00e+00 = 9.00e+00 "

Here is what I have so far:
 
public static void main(String[] args) {
 Scanner in = new Scanner(System.in);
 while (in.hasNextDouble()) {
 double num1 = in.nextDouble();
double num2 = in.nextDouble();
String s = "";
 
[Code] .....

View Replies View Related

Making Object And Adding To Array

Oct 2, 2014

I need to be able to call this method and it should take the object and, add it to my list of items, but I am having trouble getting it to work. I know the numbers and stuff aren't correct eventually it will add one to the array length when i call add item, but I am just trying to go one step at a time

//creates new MediaItem object and add it to items[]
void addNewItem(String title){
MediaItem object = new MediaItem(title);
MediaItem[] items = new MediaItem[1];
items[0] = ("object.getTitle()");
numberOfItems = numberOfItems + 1;
System.out.println(items[0]);

View Replies View Related

Making Coin Star Simulator

Oct 13, 2014

I have been tasked with creating a coin Star simulator. This accomplishes which accomplishes the following tasks:

Prompts the user to enter coins:

(example inputs): (Note, these can't be like a numerical input followed by a word input, it needs to be one line)

4 quarters
3 dimes
0 pennies

All of which would be allowed inputs.

If an incorrect format is used it should tell the user to use the correct format of number space cointype

After every new input it should give a running total of the current money the system has stored.

this loop should continue until the user enters the phrase "finish"

Then, this system should output the money (minus 9.1% fee) in the largest denominations possible (up to $20)

So if the total came to $ 131.33 (after fee)

It should output:

6 twenties 1 tens 0 fives 1 singles 1 quarter 0 dimes 1 nickle 3 pennies.

and then maybe some cheeky text about how the machine stole your money.

The actual coding for me however is very difficult as I really don't know how to convert the string input from the user into usable numerical and substrings for the calculations.

I have some basic skeleton code worked out, but its only designed to run once.
 
import java.util.Scanner;
 public class CoinStar {
Scanner input = new Scanner(System.in);
public static void main(String[] args) {
/** this first section is supposed to take the string from the user and separate it into two substrings,
* one integer, one word string
*

[Code] ....

View Replies View Related

Making Dynamic Website In Java

Jul 23, 2014

This might make me look pretty silly but I was curious if there was a way to make a dynamic web page in java. Basically only using pure Java, with only HTML5, CSS and mySQL.

View Replies View Related

Making Integers Have Limited Numbers

Aug 14, 2014

I want users to input their phone Number But I want to make sure it is a phone number so they don't just do 1 and then leave it.

public static void main(String[] args) {
// Create the Scanner
Scanner in = new Scanner(System.in);
// Create the Variables
int phone;
if(phone > 100000000000 || phone < 100000000000) {
System.err.println("Error");
}

By the Way there are 12 digits in the if statement so that is 11 0's. Because all phone numbers are 12 digits.But when I run it, it comes up with an error saying The literal 100000000000000000000 of type int is out of range.I don't know how to make it so that the int has a limited number.

View Replies View Related

JMenuItems - Making ActionListener For Each Button

Jul 13, 2014

So I have this issue with ActionListener, I have created JMenuItems in a loop and applied them to JMenu's. But now when I want to make an action listener for each button, I'm not sure how to select them individually as in the loop it's 1 object looped through different names.

Here is the way I made the menu.

package com.simbaorka101.te.gui;

import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import com.simbaorka101.te.reference.Reference;
public class Menu extends JMenuBar{
private static final long serialVersionUID = 3601135828398064405L;

[Code] ....

View Replies View Related

Making Graph Work Correctly

Nov 9, 2014

I'm working on a homeowork assignment here URL... and I can't get the graph to work correctly. I'm not really sure how to print the string of names, gender and rank at the point on the graph. Also I'm just wondering if I set up the scanner to find names right.

import java.util.*;
import java.io.*;
import java.awt.*;
public class Names {
public static final int year = 1880;
public static final int decades = 14;
public static final int decadeWidth = 70;

[code]....

View Replies View Related

Swing/AWT/SWT :: AffineTransform Making Image To Move

Aug 5, 2009

I've been trying to make an image rotate in a panel. I did it. But also i want the image to make a translation.

Here is the code i tryed at paintComponent() :

//////////////////////////

Graphics2D g2 = (Graphics2D) g ;
AffineTransform at = new AffineTransform() ;
// at.rotate ( angle in radians ) ;
at.rotate( this.getAngulo(1, 1) ) ;
g2.drawImage(imgemFlecha, at, this);
/////////////////////////////

I cant change image x,y doing this drawImage(). I want to make that change.

View Replies View Related







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