Swing/AWT/SWT :: Append Always Visible JTable Footer At The Bottom Of Table

Nov 27, 2014

I am building a little application for personal use where I can track my finance. Now, what I would like to get is an always visible JTable "footer" OR horizontal space field attached to the bottom of the window. The idea is that scrolling down/up wouldn't affect it's visibility(like JTable header). Might a picture tell a thousand words: see attachment.

I am wondering, maybe JTable OR TableModel class has a property to solve this problem(I haven't found any)? Or shall I make another ScrollPane/JPanel? Which path of search shall I pursue?

View Replies


ADVERTISEMENT

Swing/AWT/SWT :: Trying To Define Visible JTable But Failing

Apr 4, 2014

I'm trying to make a simple table with JTable class by reading the following tutorial but when try to see my JTable my program doesn't show me nothing! What i'm doing wrong?

[Code] .....

import javax.swing.JScrollPane;
import javax.swing.JTable;
public class MyFirstTable {
public static void main( String[] args ) {
String[] columnNames = {"First Name",
"Last Name",

[Code] ......

View Replies View Related

Swing/AWT/SWT :: How To Set Visible Of JScrollPane And JTable To True When Clicking A Button

Feb 13, 2015

In my code where the Button Action Performed is created, I have done the following to ensure that the visibility of the JTable and JScrollPane have been set to true. But it does not work?

Code below:

private void RunQueryButtonActionPerformed(java.awt.event.ActionEvent evt) {
jScrollPane2.setVisible(true);
table_001.setVisible(true);
try {
PreparedStatement st =conn.prepareStatement(SQLTextEditor.getText());
ResultSet rs = st.executeQuery();
table_001.setModel(DbUtils.resultSetToTableModel(rs));
table_001.setAutoResizeMode(table_001.AUTO_RESIZE_OFF);

[code]....

View Replies View Related

Swing/AWT/SWT :: SQL Server Table In JTable

May 29, 2014

I am attempting to show a GUI that will show records from a SQL Server table. That part I have done. However, I need to allow the user to be able to edit the Approval field of the table when he/she views it. Following is my code:

package manual_checks;

import java.sql.*;
import java.util.*;
import javax.swing.*;
import javax.swing.table.TableColumn;
import java.awt.Font;
import javax.swing.event.ListSelectionListener;

[code]....

View Replies View Related

Swing/AWT/SWT :: JMenuBar Object Not Visible In JFrame

Nov 13, 2014

I' currently wrking on BeatBox application from Head First Java. I made a jpanel the pane of the frame & when i try to add a JMenuBar object to that it is not getting displayed when i run the code. When i add a menuBar directly to the JFrame object it is visible & working fine but not incase when added to JPanel.

package com.java.BeatBoxGUI;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;

[Code] .....

View Replies View Related

Swing/AWT/SWT :: Append Text To Textarea From Another Class

Aug 2, 2014

Class 1 open main frame

Class2 add panel for main frame

Class3 append text to Jtextarea (of panel class2)

View Replies View Related

JTable - Button In Table To Delete Row

Feb 16, 2014

My programms is working perfectly except for one little detail that annoys me. I have a JTable with a button on the first column that allows to delete this row from the table. Its working well except when I try to delete the last row of the table, the button stay there and then the table freeze and i can't delete any rows because i receive a "Out of bound Exception" . But, when I use the command table.getRowCount());

Before and after the removal of the line, the table "knows" that a line was removed but as i said, the button stay there. The screenshots in thumbnails show the situation before and after clicking the button next to the "Year" cell.

It's good to add that i'm adding rows in the table from a button outside the table.

Heres my code:

Main.java

static String [] title = {"X","Nom","SRM","Rend.","%","Kg",};
static Object[][] contenu;
static DefaultTableModel model1 = new DefaultTableModel(contenu, title);
static JTable tableauGrains = new JTable(model1);
 tableauGrains.getColumn("X").setCellRenderer(new ButtonRenderer());
tableauGrains.getColumn("X").setCellEditor(new ButtonEditor(new JCheckBox()));
ButtonRenderer.java

[Code] ....

View Replies View Related

How To Merge Two SQL Table Columns Into One JTable Column

Sep 5, 2013

I have a database table containing two columns A and B. They both contain integers. I'd like to know if it's possible, when displaying them in a JTable, to be combined in one column X. I still need, however, to be able to distinguish them from each other when selecting a row from the JTable. E.g. to store each of the values in a a separate variable. Maybe I can combine them when reading from the ResultSet and use some sort of delimiter ? But how?

View Replies View Related

Merge Attributes Of Different MySQL Table Into JTable Netbeans

Jul 12, 2014

I've 2 tables in my MySql DB,Employees and Assets & I want to pick 2 columns Employees and one column from Assets,then how would I display them into a JTable??

View Replies View Related

JTextfield And Jtable - Get Users Input From Field To Table

Sep 13, 2014

I have project to get from users input like name,surname,to save to Jtable,i have table and jtextfiled but when user get input they don t save to table here is my code:

 Project.zip (33.54K)

public class Projektni extends JFrame {
public final JTextField ime = new JTextField(10);
public final JTextField prezime = new JTextField(10);
public final JTextField index = new JTextField(10);
public DefaultListModel podaci = new DefaultListModel();
public JList lista = new JList(podaci);
String kolone[] = {"ID","Name","Age"};

[Code] ....

View Replies View Related

JTable With ImageIcon - How To Use Array With 4 Values In Table Cell

Mar 22, 2015

I would like to create a JTable.
 
Each cell contains an array of 4 objects:

[0] ImageIcon
[1] ImageIcon
[2] Number
[3] Boolean

1) Once JTable is displayed, each cell display only [0] .
2) Later, based on user mouse click on cell, cell should display [1]
 
How can I use an array with 4 values in Table Cell?

View Replies View Related

Swing/AWT/SWT :: When Click On Button From Bottom Panel Top Panel Need To Be Redrawn

Apr 1, 2014

When i click on the button from bottom panel, top panel need to be redrawn. But redrawing is not happening. It happens only when resizing the applet.

public class Graphics_Chart(){
public init(){
JScrollPane topPane = new JScrollPane(new ImagePanel2());
topPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
topPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);

[code]...

View Replies View Related

Save JTable Contents So Table Data Remains After Program Restart?

May 22, 2014

how I would achieve the concept of saving the contents of a JTable, so even after program restarts, the table would retain the data. I am developing a utility that will be a password storage book. The user enters passwords and they are stored in a JTable. Currently, the table resets whenever the program is restarted, however I would like it to keep it's data. URL....

View Replies View Related

Set Footer And Header In Document Using Java

Aug 14, 2013

How to set footer and header in word document/PDF using POI/open office. Using Java COde.!!

View Replies View Related

Swing/AWT/SWT :: Panel Doesn't Refresh When New Component Added If Smaller Than Largest Visible Component

Jan 26, 2014

I have a JPanel that's using a simple GridBagLayout.

JPanel panel = new JPanel();
GridBagLayout qPanelLayout = new GridBagLayout();
qPanelLayout.columnWidths = new int[] { 0 };
qPanelLayout.rowHeights = new int[] { 0 };
qPanelLayout.columnWeights = new double[] { Double.MIN_VALUE };
qPanelLayout.rowWeights = new double[] { 0.0 };
panel.setLayout(qPanelLayout);
componentCount = 0;

Based on user input I am adding sub-panels to the panel. These sub-panels may vary in height. They take up the full width of the Panel.

public void add(Component comp) {
GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(2,2,2,2);
gbc.gridx = 0;
gbc.gridy = componentCount++;
panel.add(comp, gbc_questionPane1);
}

The odd behaviour I'm seeing is that if the height of the new sub-panel I'm adding is less than the height of the largest sub-panel currently displayed then the main panel does not repaint. If its height is equal or greater then the Panel does repaint, and any sub-panels that were added but not visible before are now painted. What have I missed?

View Replies View Related

JSF :: 2.2 And Netbeans 8.0 - Create A Website That Has Common Header / Footer And Menu

Aug 26, 2014

I am working with Netbeans 8.0 and JSF2.2. I am trying to create a web site that has a common header, footer, and menu. The only part that would be dynamic is the content. So here goes...

1) I need a common template that has 4 parts, Header, Footer, Menu, Content
2) The header, footer and menu are to be in a separate files of which are called from the main template
3) The content will change based on the menu item changed
4) The menu has to change the content section only

I know how to do this in HTML but I am trying to set up some thing in JSF to learn more on JSF pages. All I am looking for is an example that I can follow along with having the multiple pages as well having the menu change the content (I have done a ton of internet searching but nothing really fits the bill).

This is the code I have currently.

Index (Main Template)
<?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:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html">

[Code] .....

View Replies View Related

Swing/AWT/SWT :: JTable With Fixed Row

Nov 9, 2008

My JTable has a row, row number 0, which I always want to be at the top.I tried the following two approaches, both without success:

1- Use a custom table cell renderer for the header, and create a header of two rows. the second row is my JTextField.

Problem: I cannot get the JTextField to function properly. (I've seen examples with a checkbox in the header, but that one just reacts to a click somewhere on the header, my textfield must be editable).

2- Use the first row of the table. This works quite nice. However, I must prevent row 0 to be re-ordered when sorting the table.

I was thinking to add a prefix (either something like "___" or "zzz" depending on current sorting mode), but I do not know which methods to adjust for this exaclty.

Another approach would be to have N textfields above the JTable in some layout (or two JTable's on top of each other).

However, Then I would need to react to the re-ordering and re-sizing of all columns as well, which does not seem easy to me.

View Replies View Related

Swing/AWT/SWT :: Using JList Instead Of JTable?

Apr 18, 2014

Can I use Jlist instead of Jtable for showing database table data (select * from employee) in my code?

View Replies View Related

Swing/AWT/SWT :: Can't Select The Very Last Row In A Jtable

Mar 26, 2015

I have encountered a very tricky spot in a project that i am working on. I must have a JTable to programmatically select the very last row in an AbstractTableModel. I have tried every thing but nothing works so far.

The problem is is that the JTable only scrolls down to the second last table row in the model? What am i missing?

//Show the very last row in a tablemodel object using the method updateTableRows
//after an "insert action event" occurred
public void updateViewMode(String name,
java.util.List<NetworkSwitch> list,
boolean flag) {
CableTableModel model = cableTable.getCableModel();

[code]....

What happens is that the only row that gets selected is the second last row of the total rows iny AbstractTableModel object, "CableTableModel"

What am i missing?

View Replies View Related

Swing/AWT/SWT :: JTable Not Getting Updated

Nov 17, 2014

I am preparing a small solution. Below is how the functionality works.

1. Login Screen
2. Successful Login will take to a MDI Form
3. Click the menu, a JInternalFrame will open in the JDestopPane.
4. JInternalFrame has a JTable.
5. JInternalFrame has a JButton available for adding new data.
6. When JButton is clicked, a new JInternalFrame is popped up with some JTextField and JButton to save the data.
7. After saving the data (after insert query), a JDialog is opened to upload Logo (update query for BLOB), There are two buttons in the JDialog, one is for uploading the image, another one is uploading it later.
8. The logo is displayed in the JDialog and if the JButton, for upload is pressed, update the database and reload the JTable in the JInternalFrame is called.

My challenge is in point 8. The function is called properly, but the table is not getting refreshed.

JButton in JDialog for uploading the Logo
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
JOptionPane.showMessageDialog(this, "Image Uploaded Successfully");
companyConfig cc = new companyConfig();
//cc.reloadTable();
cc.updateTable();
this.dispose();

[code]....

View Replies View Related

Swing/AWT/SWT :: JTable Sum Of A Column

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

Swing/AWT/SWT :: JTable Instead Of JTextArea

May 3, 2015

i have this code when i selected a node it display the attribut and value of it in JTextArea but i want it into table :

public void valueChanged( TreeSelectionEvent event )
{
if( event.getSource() == jtree ){
{
FramePrincipale.getExplorePanelll().setText(null);
TreePath path = jtree.getSelectionPath();
String a = changeString(path);
Hashtable env1 = System.getProperties();
env1.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
env1.put(Context.PROVIDER_URL, "ldap://localhost:11389/");

[code]....

View Replies View Related

Swing/AWT/SWT :: How To Update The Table On Screen

Mar 11, 2014

I'm writing my first bigger program (mysql connection and the first thing bigger than 300 lines ). What I'd like to do is to render data from MySQL using JTable - I managed to handle all the queries but I don't know how to update the table on screen. I've tried to use repaint() but nothing happened. I'm not posting whole code because you'll probably not interested, below are the most important things. I thought about using TableModel but how.

public class Main implements ActionListener{
JTable table;

public Main() {
JFrame frame = new JFrame("Frame");
frame.setLayout(new FlowLayout());
frame.add(table);

[code]...

View Replies View Related

Swing/AWT/SWT :: How To Format Value In Table Model

Nov 14, 2014

public PurchaseTableModel() {
try{
//establish connection
conn = DriverManager.getConnection("jdbc:odbc:SupplierDS");

stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);

[code]....

I get the value from database and display in table , price value will show 6 decimal and date value will show date and time.What to do to show only 2 decimal places and only date e.g. 1/1/2014 in the table ?

View Replies View Related

Swing/AWT/SWT :: Table Model Removal

Dec 18, 2014

I have 2 different bespoke table models.

When one is needed I simply add it to the table. In this case however whilst updating the model via table update in tableChanged method I have the impression of 2 identical models because the update happens twice (use of audio).

Is it not true that adding a new model cancels out the other ? I test for which model is attached to table and add the correct one depending on the data required.

assert (!(this.getTableModel() instanceof KeywordBeanTableModel));
this.initKeywordBeanTableModel();

View Replies View Related

Swing/AWT/SWT :: How To Get Data From JTextField Over To JTable

Jun 20, 2014

I am trying to get the data entered in a JTextField into a JTable but not clear on how. The LeftPanel is where the button is located and the RightPanel is where the JTable is. I want the actionPerformed to update the row of the JTable but I can't figure out how. There is another class that controls the GUI but did not think it was necessary to include. Also, I am aware that I am getting an error at the addRow line, can't seem to alleviate it.

public class LeftPanel extends JPanel {

private static final long serialVersionUID = -2311952438693382407L;
private RightPanel rPanel;
public LeftPanel(){
Dimension size = getPreferredSize();
size.width = 250;
setPreferredSize(size);

[code]....

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved