Connecting two columns in two different comboBoxes - java

I connected MySql database with Java app, I see data from two different columns (Items, Price) but I want to connect them somehow, for example, if choose in first combobox item "Desk" the other combobox should automatic find "Desk" price and display it in second combobox. Anyone have idea how to make that ?

You could write a changelistener for the first box, then have it go into another sql query which will populate the second box. Check out this guide, it'll explain to you how to do it
https://docs.oracle.com/javase/tutorial/uiswing/events/changelistener.html

First, I think that you don't want to ComboBoxes being correlated in such a way. There must be a better design for your gui.
Is your ComboBox from JFace? There are JFace Data Bindings. Normally, you use them to automatically update your model if someone changes values in the user interface. If your model contains an id from your database, both comboboxes can have a binding to this id.

Related

Android autosized Table with autofilled cells?

I'm currently working on an App which should display a table of data. The data shown depends on the user's choices. I want to implement this table which should be autosized and scrollable, but I can't figure out how I could do that using a loop. Maybe you guys can help me by just giving me an example of how to implement such a table, maybe even with the specified data which the user chose in the first place.
PS: The things the user can choose are e.g. date, subject and teacher, so the table has 3 columns (subject, teacher, date). I have implemented this choice already using the jexcelAPI and an xls document, the only thing I need to do now is to implement the table to show the results.
Thanks in advance :)
you can actually complete your task using listview in andriod.And you will load the list of items displayed using baseadapter.

How to put multiple checkboxes into a form with Apache Wicket?

I want to create a webpage that looks like this one:
This is done using a table. Each row describes an object and I want to be able to select multiple of those objects. When one of the submit-buttons is clicked, I want to get the list of selected objects. I know there is the class CheckBoxMultipleChoice, but the generated output is not what I need.
I think I should use a ListView, but since the number of objects is dynamic, I do not know how to access the states of the checkboxes. Could you please tell me how I can achieve this layout?
You should use a CheckGroup with one Check component in each row.

How to edit Rows in an Abstract Table Model

Hello i have this Abstract Table which im making a video hiring application with. I want the user to be able to sort through the table with buttons I have supplied. In the buttons I have a "Show only overDue videos" so when the user hits this button in my action listener i want to be able to hide the rows not delete them so when the user clicks another button they will re-appear any ideas on how i would go about doing this?
Use the filtering support provided by JTable.
Read the section from the Swing tutorial on Sorting and Filtering for more information and examples.
1) Maintain a master Data list. Intially the table model data will reflect the Master data.
2) When the user "press show only over due vidoes", iterate the master data and filter only the required elements and clear the table model and add only the filtered data to the table model and fire table model changed.

Struts 2 - How to populate a combobox considering another combobox choice

I would like to know what I am doing wrong or if I am on the wrong track, trying something impossible.
In my jsp I have two s:select and some textfields. Considering the choice of the first one I have to go search some informations on my database. What I am trying to do is everytime I choose some option in my first combobox I call a method im my action, this method get the informations I need from my mysql and populate my list(this list is the options of the second combobox), but of course this is not working because I am not reloading my jsp, the problem is that I cannot reload because I don't want to lose the information I have in the textfields.
I appreciate any kind of help.
you'd better use Ajax to load the data for your first ComboBox or some other fields data (page without re-loading,thus)

Creating front-end user interactive table using MySQL as back-end

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

Categories

Resources