I have to create another xml doc with the properties of nodes from the first doc. For the new doc I have to create a parent node called "definitions". Instead of the "model" node in the first doc I have to create a "process" node in the new doc that has an attribute "id" which value is the same as the content of the "id" child node of model. For each "nodes" node in the first doc if their "stencil" child node content equals "TASK" I create a "task" node in the new xml doc.
I just wanted to know if this is the correct way to define the respective classes.any way to create and fill the nodes for the new doc using this classes? I am used with DOM parser and I know how to create nodes and fill attribute values, but I have always done this job in a single class, not using different classes for the elements.
I am trying to create a code which allows the users to create JButtons to a an existing frame.So what I want is that users can create buttons wihch opens a URL. The user need to be able to click on an Existing JButton called "Add Favorite", insert the name of the favorite and URL and the button is added with the functionality to open the URL in Internet Explorer.
I already have a beginning but have no clue how to add that functionaly to create JButton by pressing on button "Add Favorites" with the needed functionality The functionality needes to be added to Button4 ("add Favorite" ). As you can see, Button4 ("add Favorite") opens two inputShowDialog which allows the users to insert the name of the favorite and URL.
import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.JButton.*; import java.awt.Dimension.*; import java.lang.RuntimeException.*; import javax.swing.JOptionPane; public class Favorites extends JFrame implements ActionListener{ //private JPanel panel1 = new Jpanel ("Add Favorite");
In the case that vehicle.color is null what will happens? A null pointer error?
null will be concatenated to the string in vehicle.color place? or will not concatenate anything in the place of vehicle.color I'm asking that because I do not know if I have to check for null in each property of vehicle that I must concatenate (there are a lot of properties in the Vehicle object and some may not been set (they will return null).
So I am trying to add a logo to my existing program. However nothing shows up when I run it. I am getting no errors and everything else seems to be fine. This is just the logo part if you need the whole code it will be separate (just trying to make things easier.
class Logo extends JPanel { public Logo() { super(); setPreferredSize(new Dimension(200,200)); } public void paint(Graphics g) { g.setColor(Color.red); g.fillRoundRect(60,60,110,90,5,5); g.setColor(Color.black); g.drawString("DEAD BUG", 70, 105);
I have an EJB project which is deployed in Webaphere 7 and i do not have source code for that project.I know the EJB session bean class name, can i generate the client for this class/project to invoke the session bean?
I would like to make an incremental change to an existing Java program. And the program has been installed on the user's machine. Now I only want to do an incremental download (to minimize the download time) to update the program.
I do most of my file I/O with {Scanner} for input and {PrintWriter} for output. I've got lots of places in my code that looks like:
Scanner source = new Scanner( new File( sourceName)); PrintWriter dstntn = new PrintWriter( new BufferedWriter( new FileWriter( dstntnName)));
But when I call the constructor for {PrintWriter} up above, it overwrites whatever the original contents of the file designated by {dstntnName} were, doesn't it? Is there a way to call the constructor so that any future writes to it simply append to the original contents, instead of overwriting them?
I am trying to mavenize an existing enterprise application and this application has EJB, MDB and MQs. As far as the folder structure is concerned, it has a project that creates an ear file, and has one for project for web and another project for EJBs. there is one more project that holds some property file.
I am trying to mavenize this this application, so that I am able to create an ear of application containing the war of web project, jars of property project and ejb project and I am badly stuck.
I know there was a change in the later versions of Java where the C++ equivalent of a <template type> was added. Unfortunately the change has 'broken' my older code. If I have a JList and I want to add elements to it then now I should specify the type e.g., the list will store Strings. When I do this and then add data to the list (or actually the list model) the code is ''fixed". However if after adding those new elements to the list I later need to add more elements, which isn't unreasonable for a list...to have elements added dynamically at run time then I again get the same compiler error message that I haven't correctly specified the type:
// Error message during compilation Note: Driver.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details.
// My code
// Problem here: I try to add new elements to the list. It's the very last line of the method that results in the error. I tried various things such as:
// model.addElement(<String> s); // but so far nothing has worked. How do I add new elements to the list (model)? public static void m2(JList <String> list) { String s; int i; String [] array = new String[10];
[Code] ....
// Code is OK: Create the array of strings to add to constructor of the JList
public static String[] m1(){ String s; int i; String [] array = new String[10]; for (i = 0; i < 5; i++) array[i] = i + "*"; return(array);
[Code] ....
// The change I had to make when compiling under the newer version of Java to indicate that the list would store strings
// Things are okay here now but then when I try to add new elements to the model via method 'm2' that's where I get the compiler error
I am modifying existing code to display graph after pressing calculate button. The graph pop ups in new controller/window. The pop up disappears after closing the application entirely. However I have trouble figuring out if it is possible to close that old/previous pop up and new pop up appears when calculate button is pressed again. Or at least reuse the pop up to display a new graph.
public class AdamCalculationApp extends AbstractCalculation { /** * Does a calculation. */ public void calculate() { // Does a calculation control.println("Adam Calculation button pressed."); double k = control.getDouble("k value"); // String must match argument of setValue control.println("k*k = "+(k*k)); control.println("random = "+Math.random());
I have a project of biometric integration by java and i have that javaApi with me for that project i need to add native libraries through NetBeansIDE7.4. I am trying like this
Right click on the ProjectSelect PropertiesClick on RUNIn VM Options TYPE -Djava.library.path="D:/bio-metric/SBXPC_CORE_130330/SBXPCJavaProxy.dll" press Ok but still I am getting Exception java.lang.UnsatisfiedLinkError: no SBXPCJavaProxy in java.library.path
I have a Linux Server Debian 7 x86_64 Minimal With java version "1.7.0_65" installed..Its an online Game Server wich Players can join just like other Services.Every 10 - 15 minutes all the players get kicked from the server and get this messege: "internal exception: java.io.ioexception: an existing connection was forcibly closed by remote host"
The players can't join the server for 10 seconds and the server console doesn't show anything for 10 seconds.it doesnt show that the players even left! and when the players try to join they get htis messege: "same nick is already playing"
After 10 seconds everything will work and players can join again and server console say that everyone left and joined..But that happens again after 10 minutes and im losing lots of players because of this error.
I want to embed an existing JAVA applet in to my swing application which is a standalone application. The applet is used in some other application which is not developed by me or my company. The application is open source application (So I have the source code). The entire existing application is basically one of the parts of my new application.
File destHtmlFolder = new File("C:/bea/user_projects/domains/OICDomain/DOC_SERVER/REPORT_HTML_DUMP"); File srcExcelFolder = new File("C:/bea/user_projects/domains/OICDomain/applications/IIMS/IIMS/target/source/REPORT_EXCEL_DUMP");
I currently have some code using a JFrame. I am trying to access the items in a JList to save them in a TXT file. For this, I am using a "for" loop. The problem is, is that when I try to access the list items, I can't access them. The way I am trying to access the items is by using:
BUT, I can't seem to get this to work. I tried to place this for loop everywhere and I can't access it. I tried accessing it under "public class Window", "private JFrame frmPcPartBuilder", "public static void main(String[] args)", "public void Initialize()" and I can't seem to access the JList. I basically have a save button that saves the list to a text file and the code I am trying to write is called by this button.
A triangle is defined by the x- and y- coordinates of its three corner points. Compute the following the following properties of a given triangle: the lengths of all sides, the angles at all corners, the perimeter and the area. The program must prompt a user for the point coordinates. I have created a class Triangle and a class TriangleSimulator, I am stuck and can't figure out why my program won't run correctly.
import java.util.Scanner; public class Triangle { Scanner in = new Scanner(System.in); private int x1; private int x2; private int x3;
I have a problem. Depending on one of the request variables, i need to load different properties files. All these property files have same keys, but with different messages. I need to take the user to different sites(though internally, the backend logic remains same...Look and feel of the front end along with messages to be shown change to make the users feel they are being directed to a different site).
I am thinking of loading the properties file from the JSP when the user logs in first time from login page so that these properties are available until the session expires & not read the properties file in Controller.
I'm developing an Applet that print a bar code using Jpos API. I need some jars and two configuration file. I've added jars to the classpath and configuration files in src directory. In Eclipse everything works fine.
DefaultProperties prop = new DefaultProperties(); prop.loadJposProperties(); SimpleXmlRegPopulator xmlReg = new SimpleXmlRegPopulator(); xmlReg.load(wincor.jpos17.THxxx.xml");
Everything works fine in Eclispe but I can't find property files when i call the applet from a web page. So I've checked the JavaPos sources and I've paste the loadJposProperties() and xmlReg.load("wincor.jpos17.THxxx.xml") content in my source code:
InputStream isD = prop.getClass().getClassLoader().getResourceAsStream(prop.JPOS_PROPERTIES_FILENAME); // (1) content of loadProperties if (isD != null){ System.out.println("jpos/res/jpos.properties found");
[Code] ...
The same method is used to found wincor.jpos17.THxxx.xml. So when I call applet form the browser I get INPUT STREAM FROM PROPERTIES OK!! from (1) and jpos/res/jpos.properties not found from (2).
So getClass().getClassLoader().getResourceAsStream works if i write it directly in my code, but doesn't work if i call a jar method.
I am quite new to java and trying to print all the system properties with the following
code:System.out.println(System.getProperties());
This prints all the properties as expected but I am wanting to put each property on a new line and am struggling a bit. Obviously I will need some sort of for loop etc but im just not sure how to do it. Is it something along the lines of:
for (int i = 0; i < System.getProperties().size(); i++){
What my understanding of what the above is doing is checking how many properties there are an looping round for each property that exists, so all I need to do is get the property 1 at a time however I am not sure where to get the property value to input into the System.getProperty(); method.
I have just tried to learn java this week [COLOR="#000000"]and I am being held back by this once installed java jdk I nav to the java file and the bin file and then the javac file to find that the below tab does not exist
A new window should pop up giving the properties of the javac, there should be an attribute called Location..I can see the location option in my documents but in no other folder
So I have an Enum file with 119 constants and each constant of that type has 20 fields that come with it. All the fields are the same type and named the same (e.g. there are 119 of Object obj, one for each constant), and I want to run the same methods over them. Since the Objects of the same type are named the same for each constant, I just have them named explicitly in get-er methods.
This worked fine when I just put all 20 fields through the constructor and set them as fields under all the constants. But I realized that if I wanted to make an instance of this Enum class, I'd have to enter in all 20 fields when they are all a set of Objects with unique values. So I then put them as fields under their own respective constant to make it easier to create instances of this enum. But now my methods don't work.
A) I don't really understand why they don't work anymore? B) Is there a way to fix it without putting all the methods under each constant?
Example:
public enum MyEnum { AAA { private MyObject obj = new MyObject (3.0); }, BBB { private MyObject obj = new MyObject (1.5); }, CCC { private MyObject obj = new MyObject (6.5); }, DDD { private MyObject obj = new MyObject (3.5); };
public double getObjVal() { return obj.value(); // it can't find this obj should I move it up to where the constants are declared? } }
How do I get java to tell me what it thinks the current deployment configuration properties are? I'm aware of Deployment Configuration File and Properties and see it tells me what the values are, how to set them, etc. But what I want is a way to run java and have it cough up what it's currently using. Something like 'java -display-config-properties' and have it spit out all current values it's using.