I am almost in the end of one project and I would like to add some tools that will make the user more friendly with the program so I decide to create something like mini frame in which I will explain every part of my program. Now I am going of course to create a class for example let's say HelpFrame in which I am going to have a lot of categories and the user will choose one of them and with cardLayout I am going to show inside the Frame doc files which explain the current category that user ask for.
So my first thought was to make a frame then use BorderLayout, on the West I am going to add the Panel with the users options and in the Center of the BorderLayout I am going to find a way to display this doc files (if I am going to use JPanels then I will have to use cardLayout so I can change JPanels inside the frame) so my first thought was to create a JEditor or JTextPane and read/open the doc file. Ok that was fine for files with only plain text as I was expected but the problem that I have to deal with is how to open a doc file when this file contains Images and plain text of course?
Is it possible with JEditor or JTextPane? or I have to find another way to do something like that..
I read the JEditor API and I find out about HTML solution (if I have right) but I want to leave this option as the last one cause I am not good at all in HTML
I can create Images rather than doc files and then I can just draw or add that images into JLabel and show them inside the Frame.. but I don't want to do something like that cause I feel like it is the wrong way..
I'm very new to Java, and I am creating a program that takes multiple user input to create one face. I have a class for the eyes, nose, lips, and headshape. For some reason, my program is not drawing the graphics. ***for question purposes, I have only included my head shape class and my test class****
my "test" class:
import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; public class FaceTest { public static void main(String[] args) { String head = JOptionPane.showInputDialog("Would you like a circle, square, rectangle shaped head?: ");
I want to create a Sharepoint Stubbing using java api by, replacing the real files with a smaller file containing only the information necessary to retrieve the original file. Now the real file can be store anywhere and in any format as long it can be restored in a timely manner and unmodified.How can we implement this in SharePoint using java.
I have developed an application using Java JSP and PostgreSQL database which inputs data from users including multiple file uploads in different formats (MS Word, Excel, PDF etc.). The uploaded files are also stored in the database.
My client wants the software to print a report in PDF format which includes all user data entered (in a defined format) along with all the uploaded documents as appendices.
How the system can include all uploaded files into one PDF report?
I have developed an application using Java JSP and PostgreSQL database which inputs data from users including multiple file uploads in different formats (MS Word, Excel, PDF etc.). The uploaded files are also stored in the database.
My client wants the software to print a report in PDF format which includes all user data entered (in a defined format) along with all the uploaded documents as appendices.
How the system can include all uploaded files into one PDF report?
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.
Where can I learn or how can I, being the most efficient way known to do so, create a folder outside my JAR file with the java source code, this then will copy YAML documents from my JAR file to that folder, then I need to read the YAML documents some way. I'm making an addon for a game, I am using an API that allows you to make a config.yml easily, and add and read entries from it, but I've read that I need to make my own methods to be able to create additional YAML documents.
I don't exactly know what to type in google to perhaps find such a page, but I did try to find a tutorial page about this or something and couldn't.
I've partially figured out how to create a folder, but I have a problem, how can I RETURN one directory to make the folder, I don't want to make the folder in the JAR file I want to make it just outside the Jar file in the same folder that the Jar file is at.
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?
I attempted to make my square move in the screen and i set up collision with another object, however the graphics are flickering, really flickering, here's the code:
Java Code:
import javax.swing.*; import javax.swing.event.*; import java.awt.*; import java.awt.event.*; public class NewEmpty extends JFrame { double p1speed =5, p2speed =5;
I am attempting to create a n-body simulation using orbital dynamics and Java in school.
I am only in high-school, but I have some programming experience. The logic of this program comes quite easily. My problem is the graphical part, so I was just looking for quick methods to implement graphics.
What I am looking to do, is display objects onto the screen and manipulate their respective x and y coordinates as time pass. I have tried to use BufferedImages and an array of every pixel on the screen, but it quickly becomes extremely hard to draw circles etc. I have also tried the Graphics class and using g.fillOval() etc, but this can also get tedious.
Are there any more efficient methods, libraries etc? And also, how should I use the time variable, a variable that updates everytime the program updates?
I wanted to create a interface with buttons ofshapes and type of transformation where user first select a shape, the shape will appear and user will have to click on the buttons on resize, reflect, rotate or skew to transform to shape. How can i do the coding? such as adding listeners to the shapes?
What I am trying to do is save the the content drawn to my screen as an image. The following code is my render method and although I know how to use it, I don't fully understand the classes and how they work with is making this difficult.
public void render() { BufferStrategy bs = this.getBufferStrategy(); if (bs == null) { createBufferStrategy(3); return;
I have to write a program for class that basically uses Paint Component to draw a bunch of rectangles to look like a building then have them change color randomly. I am stuck I can't figure out how to make it draw the rectangles in rows and columns to look like the building i can make it display multiple squares randomly however but thats not the assignment.. here is my code
package labBuilding; import java.awt.Color; import java.awt.Graphics; import javax.swing.JPanel; @SuppressWarnings("serial") public class Building extends JPanel {
I see this is an object reference, but what is on the right side? Does not seem like a method, as it would not equal a method nor would the parentheses be on the left. Why are parentheses there? Disregarding the above code, I would like to know how to rotate without Graphics 2d
Also, with G2D you it will not allow for setting x coords
So I'm doing a project for my CS class where we have to create a snowman doing something. My picture is of Vince Young in the 2005 Rose Bowl. I'm trying to make the actual video clip from Youtube (do I need to download it? If so I can do that) appear on the scoreboard, but how.
import java.awt.*; import java.awt.event.*; import java.awt.Font.*; class snowBackground { public static void drawField(Graphics g, Color field)
[code]....
There are 3 other files that make the actual Snowmen.Also, would I need to download the mp3 sound file seperately and play that, or will inserting the video do both?
I used to think that it is simplly a tool to use to change colors and draw to specific container(ie JFrame, JPanel). However, I've been studying buffering (triple, double, flipping...etc) and how it works for 3 days now, and my confusion has only increased. for instance, why when we need to draw to the buffer(ie BufferStrategy, BufferedImage) we get its own graphics object to draw to it and then we project it to the screen? does the Graphics Object represent the drawing surface (ie the JPanel it self if we're using one to draw custom painting via JPanel#paintComponent(Graphics g)) ? so generally speaking if we are using a JPanel and we say bufferedImage#createGraphics and use that graphics object to draw to, we would not be drawing to the JPanel but to the BufferedImage correct?
what is A Graphics object for a while now, I used to think that it is simply a tool to use to change colors and draw to specific container(ie JFrame, JPanel). However, I've been studying buffering(triple, double, flipping...etc) and how it works for 3 days now, and my confusion has only increased. for instance, why when we need to draw to the buffer(ie BufferStrategy, BufferedImage) we get its own graphics object to draw to it and then we project it to the screen? does the Graphics Object represent the drawing surface (ie the JPanel it self if we're using one to draw custom painting via JPanel# paint Component(Graphics g) and so when we're getting the graphics object of a buffer, do we actually get its drawing surface to paint on? so generally speaking if we if we are using a JPanel and we say BufferedImage#createGraphics and use that graphics object to draw to, we would not be drawing to the JPanel but to the BufferedImage correct?
Page flipping is used in full screen games which entails drawing an imagine off screen then swap with on screen image after drawing has completed.
Is it possible to write a block of code to actually see this happen? Like use this technique on a window that is in windowed mode. Would it draw an image off somewhere by the desktop or would it have to be on the window?
I have a .java file which has been built into a .class file, and now I want this to be called on the click of a button on the HTML page. Is 'applet' the answer to this ? I searched around this question on the internet prior to posting but every applet tutorial I see is related to graphics and drawing blocks etc. my java file does not have any graphics, it's just a simple stand-alone code which opens a file and displays it's contents on the terminal. Would like to now see the output on the browser.
I am trying to implement a game using the ACM graphics. For the game, I am trying to make the main frame a Grid of Cells.I made a Grid class which extends GCanvas:
import acm.graphics.GCanvas; public class Grid extends GCanvas{ private final static int WIDTH = 300; private final static int HEIGHT = 300; private final int DIMENSION = 5; Cell[][] grid;
I am currently drawing graphics onto a JPanel, by overriding the standard paintComponent method.
Is it possible to call a method to draw some predefined shapes, instead of filling this method with all the stuff I need drawn, and if so, how do I do that?