Reuse Dynamically Added Controls
Nov 8, 2014
I am trying to create a form where my customer can add some other fields(like: label,textbox), and he need to use that added fields for the next time he open the application...
I would like to know whether it is possible to save dynamically created controls and reuse it again...
View Replies
ADVERTISEMENT
Aug 25, 2014
On jsp page i have created table with dynamically added rows now i want to insert the data from dynamic row field into database. How would I get the ids of those dynamically created rows to insert into database using hibernate.
View Replies
View Related
Jul 16, 2014
I am working on this project and I wanted to know if it was possible to re-use a getter, instead of having to create one for each return value (they are all of the type JPanel).
public class GamePanels {
JPanel begin, middle, end;
public void begin(){
begin = new JPanel();
begin.setBackground(Color.MAGENTA);
[Code] ....
And this is a snippet from the class which is using this class:
newButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
GamePanels g = new GamePanels();
g.begin();
container.add("Begin", g.getPanel());
cl.show(container, "Begin");
}
});
My question is, instead of creating a huge number of getters and then remembering which getter I need, is there a way to re-use the same one? Like maybe I can add a parameter?
View Replies
View Related
Oct 1, 2014
I'm new on Java/android and I wounder how could I get name of each control in a layout, ex.
for (int i=0;i<table1.getChildCount();i++ ) {
Object child=table1.getChildAt(i);
if( child instanceof EditText)
{
//get control name here
}
}
View Replies
View Related
Jun 17, 2014
I got a JFrame with its JDesktopPane, and opens a JInternalFrame at the beginning of the execution of the application. That's all fine.
And then, the first JInternalFrame opens another JInternalFrame in its maximum size, and that's when a simple JLabel that I got o the second internal it disapears. Why?
View Replies
View Related
Jun 15, 2015
I have been using JavaFX for some time now and have encountered many performance issues, mainly with the initial display of GUI elements. For example, a simple stage with a table view (with about 10 columns) and chart takes about 5 seconds to display. A color picker will take about 3 seconds from the time I click the control to when it displays the pallet. This only happens when the controls are first displayed. This can't be right. I have searched and none seems to have a similar problem so I thought I would ask here just to make sure. Here is a sample Hello world that shows the problem with the color picker (takes ~ 3 seconds to show pallet when clicked).
public class HelloWorld extends Application
{
@Override
public void start(Stage primaryStage) {
StackPane root = new StackPane();
ColorPicker cp = new ColorPicker();
root.getChildren().add(cp);
[Code] .....
View Replies
View Related
Dec 30, 2014
I have this method that does several RegEx queries along with a lot of searching and replacing of text, and each regex search / replace takes some time and a total of maybe two minutes for all of them to finish up. So I added a ProgressBar to my JavaFX form and I added code after each step to simply use the ProgressBar.setProgress method by a factor of 10% each step ... so the code would resemble something like this:
do a regex query
if it finds things then do a replaceAll method on the string being searched
ProgressBar.setProgress(.1)
do another RegexQuery
If it finds stuff, so a replaceAll method
ProgressBar.setProgress(.2)
etc...
What is happening is that the progress bar will not actually paint any progress until AFTER the entire method is done executing. So from the users perspective, they click on the button and the program appears to freeze until its all done with that method at which point it instantly changes the progress bar to the last value I set ...
So the desired effect is simply not working, and I don't know why.
I tried changing (as in replacing the progress bar with a different control) the progress bar value settings with updating text in a text box on the form, and even that didn't display any of the text messages until AFTER the procedure was done executing at which point, all of the text logs appeared at one time instead of gradually adding text to the box in increments as the method executed.So it FEELS like any time a method is actually running, the JavaFX scene simply freezes until the method is done running. And it doesn't matter if I change the progress bars value directly or put it into its own method which gets called throughout the execution of the regex method ... either way, nothing actually happens on the form until the software is done executing all of the procedures called and then it comes back to a "resting" state...
I tried simplifying it by making a single method that does two things ... it updates the progress bar and then it waits for 1 second. Then it increments a variable then updates the progress bar, then waits a second, thinking to myself that 1 second pause would give it time to update the progress bars value but even that little method would not work.
Here is the test method I created:
private void testProgressBar() {
for(int x = 0;x<10;x++) {
progressBar.setProgressBar(.1*(x+1));
try {
sleep(1000);
}
catch(InterruptedException e) {
e.printStackTrace();
}
}
}
Even that little piece of code will not actually show any changes in the progress bar until after its done looping at which point, the progress bar is filled to 100%, but I never see the first 9 changes in the progress bar within that for next loop.
View Replies
View Related
Feb 6, 2014
Is it possible to "drag & drop" controls from a db to the form design in Netbeans? InVB this is possible. How about Java - Netbeans?
View Replies
View Related
Dec 9, 2014
I have a stylesheet (mystylesheet.css) with following entry:
.flowpane{
-fx-background-color: rgb(0,0,0);
}
In then start-method of my application I execute:
StackPane root = new FlowPane();
Scene scene = new Scene(root,primaryScreenBounds.getWidth(),primaryScreenBounds.getHeight());
scene.getStylesheets().add(css.getFile());
root.applyCss();
No FlowPane gets black. But if I do that in SceneBuilder and add the stylesheet to root than after loading Fxml-file the FlowPane gets black.
Another approach:
StackPane root = new FlowPane();
Scene scene = new Scene(root,primaryScreenBounds.getWidth(),primaryScreenBounds.getHeight());
scene.getStylesheets().add(css.getFile());
root.getStyleSheets().add(css.getFile());
root.applyCss();
Nothing happens.
StackPane root = new FlowPane();
Scene scene = new Scene(root,primaryScreenBounds.getWidth(),primaryScreenBounds.getHeight());
scene.getStylesheets().add(css.getFile());
root.getStyleSheets().add(css.getFile());
root.getStyleClass().add("flowpanel");
root.applyCss();
Doesn't work too;
but root.setStyle("-fx-background-color: rgb(0,0,0) works. But I need to style my application by css-files.
View Replies
View Related
Apr 26, 2015
I am creating a .jar for a game I made. I'm not using any dev tools, just a DOS console call to java: %~dp0....javajdkinjar.exe -cfmv TheSwarm.jar manifest.txt *
My manifext.txt contains:
Main-Class: Game
But when I compile the jar, its manifest contains:
Manifest-Version: 1.0
Created-By: 1.7.0_01 (Oracle Corporation)
And I get an error about it not finding the main class. Shouldn't my Main-Class setting be added to the jar? I can manually rename it to .zip and edit the Manifest.MF but that is a huge pain when I'm testing the .jar file and regenerating it often.
View Replies
View Related
Feb 13, 2014
I have the following code. how can items be added to that list?
private List<IComponentNode> comp;
interface IAAAView {
// returns component with given code or null
IComponentNode findComp(String a);
// returns component with given renderer or null
[Code] .....
View Replies
View Related
Nov 4, 2014
I have a ace:dataTable which contains a variable number of columns. For this I use the c:forEach tag. All generated in the c:forEach are not displayed. In the sample, only columnLibelle and columnSum are displayed.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
[Code] ....
View Replies
View Related
Feb 13, 2014
I'm just a java beginner. I've spent a lot of time installing and configuring software. I'm using Netbeans 7.3 on Windows 7, 64 bit. Recently, I downloaded opencsv from sourceforge.
With no previous experience adding libraries, I read a blog post on adding the library. I think that I then:
Start a new project.
Right click on libraries
Add jar/folder
Gave the temporary path to the .jar file
After, I read the blog post again, and realized I'd missed it. This time I did:
Right click library, Add library, Create library
However, I kept getting a message that the same library already existed. If I do the first process above, I will find the same library.
However, I see no way in Netbeans to remove it. I've deleted the test projects. And started a new one. But the library now exists for all projects it seems.
I've grepped all the files under the Netbean directory, searching for "opencsv", but found nothing. The only things in the Windows registry were locations of files.
How can I delete this library permanently from Netbeans? Short of, uninstall, then reinstall? Is there a way to list all the libraries that Netbeans has?
View Replies
View Related
Jan 21, 2015
I am writing a program for finding the profit made after paying the broker. here is my code, I am wondering why Java
Code: paidBroker = commission + commissionAfterSale; mh_sh_highlight_all('java');
is being added to
Java Code: noProfit = profit - paidBroker; mh_sh_highlight_all('java');
Here is my full program, you can find these lines of code on lines 64 and 70.
Java Code:
import java.util.Scanner;
public class StockTransaction {
public static void main(String[] args) {
// TODO Auto-generated method stub
//Variable Declaration Section
[Code] ....
View Replies
View Related
Apr 27, 2014
My panel named panelIncomeInfo are not showing the components that I have added.
public class PayrollGUI {
private JPanel panelIncomeInfo = new JPanel ();
private JPanel panel = new JPanel ();
private JPanel panelPayCheckInfo = new JPanel ();
private JButton close = new JButton ("Close");
[Code] .....
View Replies
View Related
Jan 28, 2014
The following alert returns an added string instead of adding the var together to give me a total?
var tvHours = prompt('How many hours of Tv do you watch last week?');
var webHours = prompt('How many hours of internet surfing did you do last week?');
var gameHours = prompt('How many hours of video games did you play last week?');
alert(tvHours + webHours + gameHours);
Also can you store a var in an alert? e.g ( var time = alert(tvHours + webHours + gameHours); ???
View Replies
View Related
Oct 26, 2010
I have a .jar that is installed in other computer(outside netbeans). Everything works fine except with report. I am sure the libraries needed for iReport is added in my lib folder but I receive this error message when I to load the report using the program.I use command prompt to see the error:
Java Code:
java -jar projCosting.jar mh_sh_highlight_all('java');
And here is the error message:
Java Code: net.sf.jasperreports.engine.JRException: Error compiling report java
source files : [b]D:CostingRptCosting_1288072391310_955208.java[/b]
at net.sf.jasperreports.engine.design.JRJavacCompiler.compileClasses
[code]....
I have included the library in lib folder but do you think I have to install the iReport application?
View Replies
View Related
Nov 14, 2010
I am adding JLabels to my JPanel, and the last one always does not show up. For example if I add 3 JLabels, the 3rd will not show up. If i change it to add 4, the 4th will not show up, but the 3rd will now. Here is a snipit of what my code looks like:
setLayout(new BorderLayout());
for(int x=0; x<PEDALCOUNT; x++)
{
pedals[x].setBounds((x*PEDALWIDTH),0,PEDALWIDTH,PEDALHEIGHT );
add(pedals[x]);
}
A workaround that I DO NOT want to keep doing is to put an extra fake JLabel at the end of the for loop, that way everything I want to show up does, but the fake one does not.
View Replies
View Related
May 6, 2014
I have been playing around all day trying to get this to increase the value of number by one after each new runner is added. How to get the value of number to increase after each record is added?
public class Runner
{
/* static variables */
/* instance variables */
private int number; // runner's number
private String name; // runner's name
private String ageGroup; // standard, junior or senior
private int time; // runner's marathon time in minutes
[Code]...
View Replies
View Related
Feb 14, 2014
I am new to java and during my classes we built a basic calculator. I want to extend my calculator and added function to square numbers.Here is my program:
Java Code:
package calculator02;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
[code]...
View Replies
View Related
Feb 27, 2014
In the code below, under calculations, I have x=totalPrice+xXxXxX. Obviously the x's were just place holders, but I wanted to know if there was any way to add something there so the program would tally the totalPrice, store it in the x variable outside the loop, so when the loop ended it would display the total price from all the loops added together where I have System.out.println("TOTAL OF ALL ORDERS: $"+ round.format(x)); at the very end.
Java Code:
import java.util.Scanner;
import java.text.DecimalFormat;
public class ModifyOrderV2TEST
{
public static void main(String [] args)
{
//Rounding
DecimalFormat round = new DecimalFormat("0.00");
[Code] ....
View Replies
View Related
Jul 2, 2014
I'm trying to develop a system for test cases so that whenever a test case is added to a particular package it will automatically be included in testing without having to manually add that particular test case. What is the best way to achieve this? Should I use java reflection? I'm just getting started with Jenkins and trying to configure Selenium test cases.
View Replies
View Related
Sep 25, 2014
I am unable to clear disappear the background of .png image added in a translucent JPanel. I have tried it using JLabel but the image added is with white background. How can i get rid of this white background...
import javax.swing.*;
import java.util.*;
import java.awt.*;
public class HomePage
{
JFrame frame;
JPanel pnl1, pnl2, pnl3;
JLabel lbl;
[Code] .....
View Replies
View Related
Mar 30, 2014
I'm displaying a 3-column table with the column names ID, name, and salary. I made the ID into a link to go to the EditServlet class. What I'm trying to do is figure out which ID# was clicked to get onto the servlet page, how to implement that dynamically?
I know that if you put something like ?x=1 and then getParameter("x") on the servlet page would work, but then all the IDs would have the same parameters since I'm using a for loop to print out my ArrayList of objects.
My code for the jsp part is below.
for (int count=0; count<list.size(); count++) {
%>
<tr>
<td> <a href="EditServlet"><%= list.get(count).id %></a>
<td> <%= list.get(count).name %>
[Code] ....
View Replies
View Related
Mar 18, 2014
I am trying to write a program for a hairsalon, and I have a JDialog popup, where the user inputs the appropriate data for an appointment...
This includes a scrollpane with all the available services the hairsalon has to offer.
I create these checkboxes dynamically (using a for loop) after storing them in a Vector first
Java Code:
Vector<JCheckBox> checkboxVector = new Vector<JCheckBox>();
for (int i = 0; i < services.femaleServices.length; i++) // femaleServices is a string array holding the services for ladies
checkboxVector.addElement(new JCheckBox(services.femaleServices[i]));
for (int i = 0; i < checkboxVector.size(); i++)
servicesPanel.add(checkboxVector.elementAt(i)); mh_sh_highlight_all('java');
They are dynamically created for 2 reasons:
1) Many different services
2) User may add new ones over time...
The problem is I cannot reference them.
For example, if a lady wants to have a haircut and change her hair colour, 2 checkboxes will be checked... How can I know which ones are checked?
View Replies
View Related
Oct 22, 2014
context.getELContext().getELResolver().getType(context.getELContext(), null, "value")
Here "value" is an attribute name. By this we can get data type of the attribute.
By somehow can we set the type also?
View Replies
View Related