I am a doing a project on Exam Suit in Netbeans swing java application. I have done all my work like login page, sign up page etc etc. But the main problem stick with exam page. I have inserted all the question and there choices with answer(not shown) in a database. I have designed one frame, 1 label for question and three radio buttons for choices and an OK button to select the choices and NEXT button to goto next question. I can easily get the data from database of only one row. But to get the other question I should keep the code in NEXT button, but this can be done only one time. I just want to change the data from table dynamically on click of NEXT button. I am unable to do this, Please help me. Thank You.....
Since your program acesses a database, I assume that you are using ResultSet from JDBC. You need to call ResultSet.next() each time the user clicks on the "Next" button. As long as you keep a reference to the ResultSet, you can call this method until you reach the end of the data set.
Related
I currently have many rows on a table that load as a user scrolls down the page.
There is a showPrintablePageBehavior tag added to create a printable layout page upon clicking that will show the contents on the table. Currently, it only shows 25 or so rows at a time.
I am trying to figure out how to display every row on the new page once the button is clicked.
Is there anything I can add to the <af:showPrintablePageBehavior/> tag or the af:commandToolbarButton tag that could help transfer all the rows over? I know fetchSize may be an option, but I'm not sure how to implement that in.
Thank you!
To my knowledge, the showPrintablePageBehavior will not trigger a server go around. This means that you need to build another page where you fetch all data (set the fetchsize to -1) and print this. This blog https://myadfnotebook.blogspot.com/2011/01/adf-printable-pages-fetching-more-data.html shows how to do this.
I have a very basic problem with jtable. I have a jtable that has multiple columns with one of column having a button. When i click on that button a panel drops, and asks to select an option from given options. When i select that option, value replaces in one of the column.
Now, i want when i select multiple rows, and do the same thing as above, it should replace that column in all the selected rows.
Problem: Currently, my table is losing selection when i am clicking the button in one of the column in jtable after multiple row selection.
I searched google and stackoverflow a lot, but could not find anything meaningful. Anyhelp or sample code is appreciated.
Thanks
If I understood your problem correctly then the solution is fairly simple.
First of all the issue probably occurs because once you click on the button java sets a new focus on the button and therefore clearing the focus on the other rows. That won´t be a problem in a single selection because you still click into the selected row, however doing that with multiple rows in one go won´t work that way.
To solve this you need to save your previous selections in something like an ArrayList and after the whole option thing you can apply the changes to every element in the ArrayList and reload the table.
A cleaner and more intuitive approach though would be to place the button outside of the JTable.
I have been researching this for days and have tried everything I have come across, but to no avail. I have built an item checkout system in JAVA using a Derby Embedded Database and everything that I have wanted it to do works great. The only thing I can't get to work is having my table update or refresh the information displayed after the user (A) Adds a new entry in the system due to a customer checking out an item. (B) A customer returns an item and is checked back into the system. (C) The table data is changed/fixed due to a previous user error. Case in point: The user checks out an item using the check out dialogue box, then clicks the check in dialogue box but the new entry just made, does not appear. Closing out of the program and going back into it then shows the new information.
I have a method called loadTable() that makes the DB connection all the way through building the table how I want and returns the table.
So far I have tried:
- Calling the loadTable() on any event (Button pressed, window closed, etc).
setFireTableDataChanged() method.
table.setModel(), here I tried inserting the loadTable().getModel or using a temp table.
jtable.tableChanged(new TableModelEvent(jtable.getModel())).
SwingUtilities.updateComponentTreeUI(yourJScrollPane); Ultimately it gets added to JSP.
table.UpdateUI();.
((DefaultTableModel)table.getModel()).fireTableDataChanged();.
repaint().
revalidate().
So far everything I have tried, does not produce the desired results.
I know you all will want to see code, there's a lot so I don't know what I should start with. This is my first time posting so, have mercy on me if i'm going about this the wrong way. Many thanks in advance!
Creating front-end (Java) user interactive table using MySQL as back-end
Now im trying to create user interactive form.
Untill now, I have created a form view, using swing components, JLable, JTextfield where user enters data. JButtons, 'new' 'save' 'delete' 'edit', which listens user action through ActionListner.
A table that 'extends' AbstractTableModel. Table values are the ResultSet values. i have used MySQL connectivity.
Table is displayed. User can now add new row to it, using 'New' and 'Save' button.
My problem is, i need the corresponding TextFields to display the corresponding row user selects in the displayed table, so that 'edit' and 'delete' would be user interactive. users are allowed to select table's row. Need Help.
Im sorry if any mistake in my question format and language. Thank you!
i need code for creating table ...
ple help me on tis....
i need code for creating table
How much will you pay? :)
..i need the corresponding TextFields to display the corresponding row user selects in the displayed table..
For that you can use,
Give a button, like EDIT and in the event handler for EDIT use something like,
jTextField.setText( jTable.getValueAt(
jTable.getSelectedRow(),
jTable.getSelectedColumn())
.toString()
);
2.As an alternative you can also utilize the event in jtable like mouseClicked with the above code
Now regarding the edit and delete , you may utilize the focusLost event of the textfield or use a EDIT or DELETE button, and carryout the updation, which will be much reasonable option.
Additionaly have a look at this : Using JDBC with GUI API
I have a JSF/IceFaces application where there is a screen divided into 3 sections. Search fields, a grid and some details fields below. Currently if I enter some data into the search fields and click on a Search button (!) the grid shows the results and a certain method is called that puts the first result record's details into the backing beans of the details fields below the grid. This shows that there is no problem with the way I put data into the details fields.
However I have a gridclicklistener method as well that would like to change the detail fields according to the selection. After the click the same method gets called with the correct parameters that works well if invoked after the click on the Search button. The data is updated in the backing beans but the changes are not rendered even if I click the refresh button in the browser.
I found that if I click on the search button, the data-updating-method gets called from InvokeApplicationPhase.execute. When I get to this line after the grid click then it is from the ApplyRequestValuesPhase.
Do you have any ideas what could make this difference and how to get this work?
Update:
I can clearly see the updated value in the backing bean but it is not reflected on screen at all, even after F5.
I don't know what is causing your original problem.
With the icefaces push renderer however you could force an update:
http://wiki.icefaces.org/display/ICE/Getting+Started+with+ICEfaces+2#GettingStartedwithICEfaces2-icepush