Applets :: Embedding Images - How To Include Actual JPGs

May 7, 2014

I have an applet that uses JPanels to draw images in. I want to include actual jpgs now instead. The applet points to a .jar file. I want to use any number of images here, do I have to include them all in the jar file or is there another way to "point" to them (like html)?

View Replies


ADVERTISEMENT

Applets :: Display Images Of Playing Cards And Shuffle The Deck

Jul 28, 2014

"In this assignment you will use an applet to display images of playing cards. The applet should load a deck of 52 playing card images from the "images" folder that you downloaded. The applet should shuffle the deck (use a random number generator) and display the first 10 cards of the shuffled deck. Display the cards in two rows of five cards each."

That is my goal for this assignment. I've got my code compiling and I will post it below and I've got an html page but when I try to open it I get an error

import java.applet.Applet;
import java.awt.Graphics;
import java.awt.Image;
import java.util.Random;
public class Assignment12 extends Applet {
Image card1;
Image card2;

[Code] ....

View Replies View Related

Embedding Image In Textbox

Mar 4, 2014

Is this even possible? I would like to make it so I can drag drop an image into a textbox . . .

View Replies View Related

Embedding Executable JAR File In A Webpage

Feb 20, 2014

Embedding an executable .jar file on a webpage. I am not a programmer and we use Blackboard Publish to package our Blackboard sessions into a standalone executable .JAR file which gives the user the full Blackboard experience. We want to embed this file on our webpage, so I did some research and I understand I have to use a Japplet (?). I have tried putting the basic (J)applet code I found on the web (modified of course) onto the webpage (see code below) but I get a 'ClassNotFoundException' error. I don't have the ability to define the files that are in the .JAR created by Blackboard Publish. How I would go about embedding this file? I can look at the files within the .jar with Winzip but there seem to be loads of .class files and I am unclear which one my webpage is trying to find!

<APPLET CODEBASE="/Blackboard/" ARCHIVE="test.jar" CODE=test.class WIDTH=140 HEIGHT=45>
<(J)APPLET>

View Replies View Related

Embedding Windows Painter In A Browser

Dec 30, 2014

I'd like to know if there's a way to embed Windows Painter (mspaint.exe) in a browser. I'm not sure it's possible with Java and if it doesn't, any relevant reference to this subject.

View Replies View Related

Embedding Maps In Swing Application

Jul 28, 2014

I'm developing a java swing application in which i need to show the map of some area and allow user to put markers on it. I've goggled a lot on the topic but unfortunately i haven't got any how i can do it.

I came across some ideas like displaying a web browser in swing just like JXBrowser (i can't afford JXBrowser). And I'm also not sure if this way will allow me adding markers.

View Replies View Related

Formal And Actual Parameters?

Jan 11, 2014

In the following Java Code:

public static void f() {
int n = 5;
p(n, 2 * n);
}
public static void p(int a, int b) {
int x = 1;
q(x, a + b);
}
public static void q(int x, int y) {
int z = x + y;
x = 0;
...
} mh_sh_highlight_all('java');

When we write x = 0; that refers to the formal parameter int x and hence it's the formal parameter that changes value. why isn't the value of the actual parameter also changing?

View Replies View Related

How To Get The Actual Computer IP Address

Jan 31, 2014

I wrote a Chess game that uses socket to connect to another computer, and allow player vs player and player vs computer game sessions.

However, there is a problem which I noticed.

When you get the IP address of the computer in which the program is running, you are not getting the computer's actual IP, you are getting the Router's IP.

Is there a way to get around this.

So the problem is that when I go to another computer, located in a different house or lets say from my school, the program cannot connect back to my home IP, because it uses the router's ip, not the computer's ip I am running the server program.

Is there a way to get the Computer's IP, not the router's ip when summoning or invoking the get IP address method from the socket class?

When I say that the socket class is acquiring the router's ip, well that's done without my interfering...I don't know why it does that, it is somehow recognizing the router and not the computer.

The thing is that the server program is written that any client program is able to connect to the home server.

But when I run the program from a different location other than the current home, the sockets don't connect because it is somehow recognizing the router's ip not the computer's ip.

View Replies View Related

Putting Images In GUI / Images In Source File Don't Seem To Be Recognized

Jun 7, 2014

This is my class with the GUI:

import java.awt.FlowLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.JPasswordField;

[code]....

Eclipse error message:

Exception in thread "main" java.lang.NullPointerException
at javax.swing.ImageIcon.<init>(ImageIcon.java:205)
at GUI.<init>(GUI.java:26)
at Apples.main(Apples.java:7)

i think the problem is to do with my images not being recognised. I put them in my source in User>...>workspace>src which is correct as far as i know. From what i know the images should show up if i look at my src file in eclipse but they dont. I tried changing the file type from .png to .jpg but it makes no difference.

View Replies View Related

Value Types - Actual And Formal Parameters

Jun 3, 2014

public static void main(String[] args) {
System.out.println("VALUE Types");
int i = 5;
int j = 11;
System.out.println("i = " + i + ", j = " + j);

[Code] ....

Questions based on the code:

1. Identify all of the actual parameters in the code provided.
(Is it just i, j iArray and jArray)???

2. Identify all of the formal parameters in the code provided.

3. What is displayed in the third println statement?
i = 11, j = 2001

4. What is displayed in the fifth println statement?
iArray = 6 7 2001 9 10, jArray = 6 7 2001 9 10

View Replies View Related

Combinatorial Queries - Changing Parameters Actual Values

Apr 30, 2014

I have a question about query execution strategy ...

Scenario: let's suppose I've to query a table with a query like

SELECT F1, F2, F3 FROM MYTABLE WHERE F1 = ? AND F2 = ? AND F3 = ?.

I need to execute this query changing parameters' actual values in a combinatorial way, until a combination gives back at least one row or all combinations are unsuccessfully tried. For instance, I may have this sequence of values:

(V1,V2,V3);
(V1,V2,"");
(V1,"",V3);
(V1,"","");

where V1, V2, V3 may by string values and V1 is always present, not null, and not blank in each combination.

A first strategy may be to prepare the statement, clear the parameters each time I execute the query, until stop condition is met.

I wonder if may be more efficient transform the query into

SELECT F1, F2, F3 FROM MYTABLE WHERE F1 = V1

and cycling over the cursor and, for each cursor row, verify if the returned tuple (F1,F2,F3) matches the combination (V1x,V2x,V3x). When at least 1 rows matches, or all combination are done, I'll exit iteration.

View Replies View Related

Update Sequence Of Stars According To Actual English Word And Guess Character

Jan 12, 2014

Below is part Two the method I need creating:

This method updates the sequence of stars according to the actual English word and the guess character.

public static String updateSecretWord(String secretWord, String englishWord, String guessedChar)
{
}

Below is the example of how it should look like when I call it

updateSecretWord(“*****”, “Hello”, “h”) = h****
updateSecretWord(“h****”, “Hello”, “o”) = h***o
updateSecretWord(“he**o”, “Hello”, “e”) = he**o

View Replies View Related

Applets :: SecurityException When Using Applets

Dec 26, 2013

I am new to applets, and my manifest file is:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.3
Permissions: all-permissions
Created-By: 1.6.0-internal (Sun Microsystems Inc.)

Name: com/myPackage/test/client/TaskApplet.class
SHA1-Digest: pLmraui35IkgfAq+v3WGj1LwCYQ=

The error I get is as follows...When the page is loaded I get the following error: java.lang.SecurityException: class "com.myPackage. test.client. TaskApplet" does not match trust level of other classes in the same package

View Replies View Related

JSP :: Include From A Different Folder

Apr 17, 2015

I am creating a very simple webpage where I am using just a little bit of JSP to include partials (header, footer and asides) that are centrally located. One of the constraint that the site owner has put is that, for SEO reason, he wants to keep the url's the way they are. Most of the pages are located in the same folder, except for one which is in a subfolder.

Here is my problem, I have the partials in a folder and at the same level the images. Now, for that page located in the subfolder, when I include the partials, it is not able to locate the images because they are located in a folder one level up. What I could do is create a copy of the image folder in the subfolder or an adapted copy of the partials (referring to the images one level up), but either solution would make for a maintenance nightmare and repeat information on the server.

Here is a visual representation of my file system:

- Top level folder
- Partial_Folder
- header.html
- footer.html
- images
- picture_1.jpg
- Page_1.html
- Page_2.html
- Another_Folder
- Page_3.html

View Replies View Related

Include EAR File In Classpath?

Jan 23, 2014

I am writing an Ant script using the javac command but the library I need is bundled in an ear file, how can I reference this jar in ear file without extracting the ear file.

View Replies View Related

Manually Include Java API?

May 7, 2014

For some reason, when I generate a Javadoc (using javadoc.exe of JDK 8), it displays Java-defined classes like java.lang.String and java.lang.Object by their full names rather than simply String or Object. Only the classes inside the packaged contents were represented by their simple names and linked to them (had visible coloured bolding). Was I supposed to manually include the Java API?

View Replies View Related

How To Include Java File In All Projects

Mar 23, 2015

1) I have a file .java with some great functions, this functions i need use in all projects, then what is the easy by moment i start a project, and copy this file to project.. is possible have only 1 file with these utilities functions? (if yes how to declare or use in all projects?)

Note these utilities file i want use on JAVA desktop(swinf and javafx), on JSP webpages and in the futhurer on the mobile.
 
2) I have a JSP project in 1 .JSP file i have 8 Tabs (CSS tabs) when user click on tab1 i execute some jsp java code. and if user click on tab2 i execute a different JSP code, but my problem is, the JSP file is large large large, 1500 lines, my question is: is possible (similar in PHP) do an include?
 
<%
   include tab1.jsp
%>

View Replies View Related

How To Include Multiple UUIDs In Single Variable

Dec 31, 2014

My application depends on eight default user roles (or account types). They can be renamed or disabled, but should not be deleted. I want to protect them from deletion using their uuid value from the db. How can I pass their uuids into a single variable so I can use that single variable in my conditional statement? If I should use an array, any example of how I might do this?

View Replies View Related

Rectangle Class Include Try-catch And Exception Handling

Oct 18, 2014

The requirement is to write a rectangle class and a test class, which include try-catch blocks and exception handling. Exceptions, involving try, catch, throw, throws, and finally commands,how to write a code about basic things, but in the test class, it gives me specific width and height so that i dont konw how to write a try-catch blocks an exception handling in this test class.There is my two classes, they are separated.

public class Rectangle {
double width ;
double height ;
Rectangle(){
width = 1;
height = 1;

[code]....

View Replies View Related

Calculator Program - Use Strings And Methods To Include Arrays

Jul 23, 2014

My assignment is to essentially update a calculator program that uses strings, and methods, to include arrays. How to create and call an array that the user defines the size of and then inputs the numbers to fill the array. Here's the example my prof gave us of what the output should look like:

Menu
1. Add
2. Subtract
3. Multiply
4. Divide
5. Dot product
6. Generate random array
7. Quit

What would you like to do? 1

How many values are in the arrays? 3

Enter the values in the first array, separated by spaces:
2 4 6

Enter the values in the second array, separated by spaces:
1 3 5

The result is [3.0, 7.0, 11.0]

How to create an array that would allow the user to define the size of the array and then inputs the values for the array? I'm completely lost. I never should have taken java as an online class.

View Replies View Related

Create A Database Configuration File And Include All Other Files

Apr 19, 2014

I am creating an application in core java where i am using database. I need to create a database configuration file & include it all other files. So, how can i do that ?

Java Code:

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:MYDSN","system","tiger"); mh_sh_highlight_all('java');

I cannot do this in an interface since only abstract methods exist there. I tried to create an another class file to extend it but my program is already extending other class i.e. javax.swing.JFrame..How can i implement this ? just by creating the object of that class in main method ?

View Replies View Related

Include Three Sides Of Triangle Formatted To Two Decimal Places

Sep 9, 2014

My program is supposed to include The three sides of the triangle formatted to two decimal places The perimeter formatted to one decimal place The area formatted to one decimal place The unformatted area. It does run, but it is not decimal formatted. I have read my book to try and figure out how to do this, but it doesn't make since to me.

import javax.swing.JOptionPane;
import java.util.*;
import java.text.DecimalFormat;
import java.util.StringTokenizer;
 
public class ShelbyHarms_3_03 {
public static void main (String [] args) {
double a, b, c; //Input sides of triangle

[Code] ....

View Replies View Related

Random Phone Number Generator - Include Dashes In The Output

Apr 11, 2011

I've been working on a personal project again in Unit 3 of my text book and this time they want me to make a random phone number generator. Here's the actual directions:

"Write an application that creates and prints a random phone number of the form XXX-XXX-XXXX.

Include the dashes in the output.

Do not let the first three digits contain an 8 or 9 (but don't be more restrictive than that), and make sure that the second set of three digits is not greater than 742.

Think through the easiest way to construct the phone number. Each digit does not have to be determined separately."

With this assignment I came across 2 problems:

1. What I tried was that since the first 3 numbers have to be a random number with no 8's or 9's I tried doing this algorithm:

int first0, first1, first2, second, third, random0;
first0 = generator.nextInt (999);
random0 = generator.nextInt (8);
first1 = first0.replace('8', random0);
first2 = first1.replace('9' random0);

The problem is that Java won't allow me to generate random numbers this way. Are there any easier ways of generating numbers that doesn't contain specific number (such as 8 or 9 in this case?)

2. I was thinking about this throughout the whole project and what if I generate a number such as 27 (less than 3 or 4 digit number) rather than 3 or 4 digit numbers? How would it show 0027 or 027 instead of 27 for the phone numbers?

import java.util.Random;
public class pp0303 {
public static void main (String[] args){
Random generator = new Random();
int first0, first1, first2, second, third, random0;

[Code] ....

RESULTS:

Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Cannot invoke replace(char, int) on the primitive type int
Cannot invoke replace(char) on the primitive type int
Syntax error on token "random0", delete this token
at pp0303.main(pp0303.java:15)

View Replies View Related

Browser Automation / Embedding Into GUI / Attaching To Existing Browser Window

Aug 7, 2014

What best API or whatever you call for browser automation? I mean clicking links, filling forms, gathering sources and other info. I already tried selenium WebDriver. It have all needed functions but there is no feature like attaching code into already opened browser so even doing google search it opens new browser window (opening takes ~5-10secs). Also I believe that there is no way that I could embed that browser into GUI.

Also tried WebSpecs and old Watij but also didnt found any way to attach or embed browser into my GUI.

So what I need is that I could create GUI with embeded browser and bunch of buttons. I click buttons then embeded browser clicks links, gets info etc.

View Replies View Related

Inheritance Relationship Between Type Of Actual Object And Object Reference?

Apr 15, 2014

For example I create an object like this:

BankAccount b = new SavingsAccount();

Now lets say that I want to access a method 'addInterest()' that is in the 'SavingsAccount' class I would have to do: '((SavingsAccount)s).addInterest();'

The question I have is why do I have to cast 'b' to SavingsAccount? Isn't the actual object reference of 'b' already an instance of 'SavingsAccount' class? How does the 'BankAccount' affect the object itself? I'm really confused as to what class is truly getting instantiated and how BankAccount and SavingsAccount are both functioning to make the object 'b'.

View Replies View Related

Modify Class Time2 To Include Tick Method That Increments Time Stored In Object By One Second

Jul 9, 2014

Modify class Time2 to include a tick method that increments the time stored in a Time2 object by one second. Provide method incrementMinute to increment the minute and method incrementHour to increment the hour. The Time2 object should always remain

a) incrementing into the next minute,

b) incrementing into the next hour and

c) incrementing into the next day (i.e., 11:59:59 PM to 12:00:00 AM).

how to manage case 4 stuff and what's the problem of this CODE.

import java.util.Scanner;
public class Time2Test
{
public static void main( String args[] )
{
Scanner input = new Scanner( System.in );
Time2 time = new Time2();
// input
System.out.println( "Enter the time" );
System.out.print( "Hours: " );
time.setHour( input.nextInt() );

[code]....

View Replies View Related







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