Swing/AWT/SWT :: How To Hide The Column
Aug 1, 2014
Hiding the column but not removing , because i need to bring this column id to the next screen, only i do not want to show the column but internally it has to take the value to navigate the screen, but if i use below code, i am getting null pointer exception,
this.column.setMinWidth(0);column.setMaxWidth(0); column.setWidth(0); column.setPreferredWidth(0)
View Replies
ADVERTISEMENT
Aug 1, 2014
How do i hide a specific column in a JTable object.? Setting setPreferredSize to 0 is not working.
View Replies
View Related
Dec 9, 2014
There are 8 JCheckboxes, which are already added to panel and aligned in group layout. From which, I have selected one JCheckbox. Then the resultant GUI should contain only remaining 7 JCheckboxes and selected one should temporarily removed or hide from GUI . Is it possible? If so, how?
View Replies
View Related
Nov 23, 2014
In JButton's click event, I wanto to show a JPanel to print the message "Processing" on the screen. Before JButton's click logic end, hide the JPanel.
Actually, JPanel is not displayed. I do not know why.When msgPanel .setVisible(false); is commented out, JPanel is normally displayed .But do not know how to hide it when JButton's click logic is finished.
Here is the code.
loadBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
JPanel msgPanel = new JPanel(rootFrame);
// Show the message JPanel
[Code] .....
View Replies
View Related
Feb 9, 2015
I've been creating a jTable where I can add / edit /delete new entries. Now i have 2 Questions :
1) My column 0 is filled with the row-number. I created a variable and with each "add" it adds +1 to the variable. That works, but as soon as i delete 1 row there is a gap ( 1..2..4..5..).
My question: Is there another way then mine to handle this?
2) The table is/should be working as some kind of database. The user is able to add Information (height, width,...). Now I want to sum the entries of 1 column (length,...). But as they´re objects I didn´t find a way.
My question: How can I sum the entries of 1 column of a table?
View Replies
View Related
Feb 9, 2014
I have a JTable with the model " Names " , " Quantity " and " Unit " .
I'm coding a program where you get the ingredients names.
So i need to get the whole row of one column and String it all up together,because i need to store it in mySql and i have already set it all as String.
how i can do this ?
My code are as follows :
JTable Code:
DefaultTableModel model = (DefaultTableModel)table.getModel();
if(!txtQty.getText().trim().equals("")){
model.addRow(new Object[]{ingCB.getSelectedItem().toString(),txtQty.getText(),unitCB.getSelectedItem().toString()});
}else{
JOptionPane.showMessageDialog(null,"*Quantity field left blank");
}
Getting the values and for storing :
for(int i = 1; i<= i ; i++){
ingredients = table.getName();
}
This is for loop is wrong and it does not work because i have a constructor to take in Ingredients but because it is inside the loop, it cannot take it in.
View Replies
View Related
Dec 15, 2014
I have a Jtable which shows contents on each row. but the row contents which are bigger than the width of the column gets shown as "BlahBlah.." (basically getting showed up as .. in the end)
User has to manually increase the width of the column to see those extra contents.For e.g if the row contents are ABCDEFGHI and the widht of the column for that row is sufficient enough to show only ABCDEF of that, then it will show up as something like "ABCD.."Now my requirement is to show the complete contents over to next column on the same row.
Note: I could simply add the code to show the widht of the column to adjust according to largest row content for that column . But unfortunately this is not what is required.
View Replies
View Related
Sep 10, 2014
From what I can determine check boxes are applied in SWT to the first column only of a table.
final Table table_project = new Table(g3_tabfolder_projects, SWT.BORDER | SWT.CHECK);
However I require check boxes on all cells. I tried creating a table for each column (which gives me my check boxes) but as the number of enries are often numerous and thus require vertical scroll the tables become out of sync (and to the user that sync is important).
Before I knock up some code to try and synchronise the tables I just wanted to check any alternative approaches. The project is SWT based.
View Replies
View Related
Jan 23, 2014
I have a problem with my JTable.
When i run my program i see a JTable with data in it. The first 3 columns are filled with data, the next one is empty. Other columns that come afther the empty one are also filled.
So my 4th column is empty. But it only apears empty, cause when i move the 4th column to the left. The same column that was at 4th place is now at 3th place and filled up with data.
So the 4th column apears empty but it contains data when i move it to the left or the right.
Why does it show an empty column at the 4th place?
Some printscreens to get it clear:
In attachment:
attachment1 = 4th Column is empty
attachement2 = 4th column is moved to 3th place and is filled with data.
View Replies
View Related
Feb 19, 2015
I am trying to sort a JTable on an all numeric (integer) column. From what I read, if the sorter knows the type is integer it should sort correctly. This is my code:
public class ActorTableModel extends DefaultTableModel {
private static final long serialVersionUID = 1005352603826663105L;
public ActorTableModel (Object data[][],Object columnNames[]) {
super(data,columnNames);
}
public Class<?> getColumnClass (int column) {
if (column==0) {
return(Integer.class);
}
return(String.class);
}
}
The result is when I sort on that column (0), it sorts alphabetically not numerically.
View Replies
View Related
Feb 10, 2014
My code is
Double qty = 0.0;
for ( int i = 0; i < ingTable.getRowCount(); i++){
qty = (Double) ingTable.getValueAt(i,2);
if( qty < 30.0){
ingTable.setBackground(Color.red);
} else {
ingTable.setBackground(Color.white);
}
}
View Replies
View Related
May 3, 2015
I have a JTable with 5 columns, named: "ID", "Name", "UnitPrice", "Qty", and "Total". Only the columns UnitPrice and Qty are editable by the user. When, for example, for a row in the JTable, the user types 5000 in the UnitPrice column, and types 15 in the Qty column, I would want that when he types the first character in the Qty column (i.e. the character 1) in the Qty column, the Total column displays 5000*1, in other terms 5000.
And when the user types the second character in the Qty column, i.e the character 5, after having typed 1, the Total column should display 5000*15, in other terms 75000. So, to say it concisely, I would want that the Total column refreshes accordingly each time the user types a character in the Qty column. I have tried to use the MouseClicked event of the JTable, but noticed that that does not solve my problem. is there an event I should use to refresh my Total column? Or should I proceed in another fashion?
View Replies
View Related
Jun 29, 2007
How would you set a column in a JTable to make it unable to gain focus i.e. select the next column on the same row or ignore the command completely when selecting a column that should not be able to be gained focus on?
View Replies
View Related
Dec 8, 2014
The problem is that I populate the table with autoincrement primary key. I don't want it to be visible. I have been googling for hours to find no solution. It seems that sql/mysql provides no solution by selecting all table columns except one. So I wonder, how I could overcome this problem. Here is some of my code:
public void tableChanged(TableModelEvent e) {
int row = e.getFirstRow();
int col = e.getColumn();
model = (MyTableModel) e.getSource();
String stulpPav = model.getColumnName(col);
Object data = model.getValueAt(row, col);
[Code] .....
The ID is used in
stmt.addBatch("update finance.fin set " + stulpPav + " = " + duom
+ " where ID = " + studId + ";");
I tried to omit ID from my SELECT statement, I tried to put Date as a first element in data[iEil][0] but neither options were successful. Data hasn't been changed in database. NOW, everything works fine, except I don't want ID column to be visible in my table.
View Replies
View Related
Jan 20, 2015
I'm working on a spreadsheet-like table and I was able to set it so that it would highlight the first cell in the relevant row(titled 1,2,3.. etc) when a cell is clicked. (Just like in MS Excel - preview attached) Now I want to do the same to the column header(i.e. A,B,C,D....etc) . How can I do it?
private void formWindowOpened(java.awt.event.WindowEvent evt) {
setLocationRelativeTo(null);
int rowNum = sheet.getRowCount();
for(int i=0; i<rowNum; i++){
sheet.setValueAt(i+1, i, 0);
[Code] .....
Untitled.jpg
View Replies
View Related
Oct 21, 2014
Write a method that returns the sum of all the elements in a specified column ina matrix using the following header:
Public static double sumColumn(double[][] m, int columnIndex)
Write a test program that reads a 3 by 4 matrix and displays the sum of each column.
import java.util.*;
public class SumColumns {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
final int ROW = 3;
final int COLUMN = 4;
[Code] .....
View Replies
View Related
Mar 11, 2014
How do i make the 'date' column show only the date and 'timeIn' and 'timeOut' column only show the time. In my database table my 'date' column is a date type and 'timeIn' and 'timeOut' column is time.
View Replies
View Related
Apr 4, 2015
Tried it, I get red line under it, tried to do "jframe1 jframe1 = new jframe1(variable);
jframe1.setVisible(False); still failed. all I want to do is open a different jframe which I got that to work but cant hide show me how to do it without having to emend my code I want to be able to do is in same style.
CashPaybtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
//System.out.println("CashPaybtn.actionPerformed, event="+evt);
//TODO add your code for CashPaybtn.actionPerformed
//PaymentMethod.setVisible(false);
[Code]...
View Replies
View Related
Aug 8, 2014
My code is already running. But the problem is, i don't want to see 0 denomination. like for example if i input 3.86 in (dollars).
dollars: 3
quarters: 3
dimes: 1
pennies: 1
so my problem is. it still showing 0 denomination like this:
dollars: 3
quarters: 3
dimes: 1
nickels: 0
pennies: 1
Currently using latest netbeans and if im correct we are using methods and class runner?.. Anyways here's the code..
for method:
package MyPrograms;
public class Mp3Method {
public int dollars(int dollars,int remainingAmount){
return dollars = remainingAmount / 100;
}
public int quarters(int quarters, int remainingAmount){
return quarters = remainingAmount / 25;
[Code] .....
View Replies
View Related
Jul 25, 2014
Cannot switch on a value of type Object. Only convertible int values, strings or enum variables are permitted
I'm trying to hide and option using switch statement but this is the error i receive.
public void actionPerformed(ActionEvent e)
{
if(e.getSource() == comboDest1)
{
switch(comboDest1.getSelectedItem())
[Code] .....
View Replies
View Related
Mar 27, 2014
I have eight panels that are one above the other and are the full width of the frame.
I would like to hide some of them some of the time and then "bring them back".
If I use panel1.setVisible(false) panel1 will disappear but then all the panels below it move up to take panel1's place.
I don't want that to happen. I want just a blank area where panel1 was.
Is there a way to do that?
View Replies
View Related
Jul 24, 2014
I'm trying to hide a JComboBox option depending if the a user has picked a certain option from a previous JComboBox.
.setVisible(false). doesn't work
String[] Dest = new String[] {"Select Destination","Crete", "Paris", "Croatia"};
String[] Accomodation = new String[] {"Select your Accomodation","Hotel", "Villa", "Bed & Breakfast","Youth Hostel"};
String[] Night = new String[] {" Select number of Nights", "7","10","14"};
final JComboBox<String> comboDest1 = new JComboBox<String>(Dest);
[Code] ....
I know setVisible isn't the way it's done but i don't know how to do it
View Replies
View Related
Jan 26, 2015
I've made a login system with a username and a password. The password is visible and I wanna hide it, how do I do that? Here is my code (have used swing);
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Password implements ActionListener {
private String Username = "hudhud";
private String Password = "fitness";
[Code] ......
View Replies
View Related
Mar 8, 2014
I am using jsf with richfaces. Scroll bar inside panel grid is displayed. Need to disable / hide the bowser (IE-9) scroll bar.
style="overflow:hidden"
Added above style, but not working.
View Replies
View Related
May 18, 2014
I have a login window, which when sucessful will activate a new Applet/JFrame. The problem is that the login window remains in the background under the new JFrame. I want this to diappear. I want to either set the visibility to false, or close it.This is how the new window is started:
if(sucess.equals("flase")){
DBAccess dba = new DBAccess();
dba.setFname(fnameusr); //fnameusr
dba.setLname(lnameusr); //lnameusr
dba.main(null);
//LogIn.exit(0);
}else{
JOptionPane.showMessageDialog(null, "Your credentials were not entered correctly or you may not be authorised to access this system.");
System.exit(0);
}
View Replies
View Related
Feb 6, 2015
I am trying to do a rock, paper, scissors game, but when i choose for example, it shows what i have typed. So how do i hide text form showing in the console?
View Replies
View Related