Problem with JTable Header
I want to show a JTable in a scrollPane , But i don't want to show its header.
i have tried table.getHeader().setVisible(false) but it shows a gap on table top which is not desired.
If anybody can help me.
If I remember correctly, if u set the headervalues to null they wont show.
Similar Messages
-
Hello,
i have a selection problem with JTable. I want to allow only single cell selection and additionally limit the selection to the first column.
I preffered the style from MS Outlook Express where you can select the email accounts to edit.
It is a table like this:
Account name | Type | ...
--------------|---------|---------------------
Hotmail | POP3 |
GMX | IMAP |The selection should be only avaibable at 'Hotmail' or 'GMX' - not at 'POP3', 'IMAP' or as complete row selection.
Please help me!
Thanks.
WarlockMaybe this will helpimport java.awt.*;
import javax.swing.*;
public class Test3 extends JFrame {
public Test3() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container content = getContentPane();
String[] head = {"One", "Two"};
String[][] data = {{"R1-C1", "R1-C2"}, {"R2-C1", "R2-C2"}};
JTable jt = new JTable(data, head);
jt.getColumnModel().setSelectionModel(new MyTableSelectionModel());
content.add(new JScrollPane(jt), BorderLayout.CENTER);
jt.setCellSelectionEnabled(true);
jt.setRowSelectionAllowed(false);
jt.setColumnSelectionAllowed(false);
setSize(300, 300);
setVisible(true);
public static void main(String[] arghs) { new Test3(); }
class MyTableSelectionModel extends DefaultListSelectionModel {
public void setSelectionInterval(int index0, int index1) {
super.setSelectionInterval(0, 0);
} -
Hi,
I have encountered a problem with JTable, i am trying to display some 15 columns and their values , one of the columns value is null, then the JTable is not displaying its value from this column(which is with null value) onwards.
Can anybody assiss me in this matter.
Regards
khiz_engI don't know If I can fix your problem, but
I know just that it works on my PC.... It's very very
slow... I don't know how to insert PageSetUp option... I have to study the problem.....
However I don't think it's a hard problem....
I want ask to you if you have found some problems when you are in Editing mode in a cell.....
in the jdk1.2 version I could save while was in editing mode using the editingStopped method.
It permit to update all data .... also the data in the cell I was editing.
in the jdk 1.3 if I use this method It doesn't work properly... It maybe destroy the content object in the Cell..... because I'm able to print all the table except the editing cell (it throw an exception...)
What's changed????
I don't know...
Can u help me? -
Hi !
I have a problem with JTable - would like to use this component as a simple list of rows taken from a database : don't want to be able select or set a focus to a column - want only to be able select and set focus to a row ( just like in the menus). How to disable "focusability" for a cell with JTable ? Could You help me ?
thnx in advanceThe Border is changed by the renderer, depending on whether the cell has focus or not. So you will need to create custom renderers without a Border. Something like:
class NoBorderRenderer extends DefaultTableCellRenderer
public Component getTableCellRendererComponent(
JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
setBorder(null);
return this;
} -
Problem with JTable with JCheckBox as Header
Hi,
We have a JCheckBox as JTable Header. And respective data in that column also check boxes. For data check boxes, just i am sending Boolean object to object[][] data array. I am getting check Boxes as data components.
For Header, i have create a TableRender object which is returning JCheckBox.
Here my problem is,
1) When i select a Header check box, all the check boxes are getting selected.
2) Now we can reselect an data Check Box. When i reselect any data checkBox, Header CheckBox should be reselected. This is not happening. I was tried lot. Can any body give a solution to solve this problem.
Please .... Please ...
Thanks
Mohanjust call this method with null param on the JTable
table.setTableHeader(null);
cheers
krishna -
Problem with JTable and JPanel
Hi,
I'm having problems with a JTable in a JPanel. The code is basicly as follows:
public class mainFrame extends JFrame
public mainFrame()
//A menu is implemeted giving rise to the following actions:
public void actionPerformed(ActionEvent evt)
String arg = evt.getActionCommand();
if(arg.equals("Sit1"))
//cells, columnNames are initiated correctly
JTable table = new JTable(cells,columnNames);
JPanel holdingPanel = new JPanel();
holdingPanel.setLayout( new BorderLayout() );
JScrollPane scrollPane = new JScrollPane(holdingPanel);
holdingPanel.setBackground(Color.white);
holdingPanel.add(table,BorderLayout.CENTER);
add(scrollPane, "Center");
if(arg.equals("Sit2"))
if(scrollPane !=null)
remove(scrollPane);validate();System.out.println("ScrollPane");
if(holdingPanel !=null)
remove(holdingPanel);
if(table !=null)
remove(table);table.setVisible(false);System.out.println("table");
//Put other things on the holdingPanel....
private JScrollPane scrollPane;
private JPanel holdingPanel;
private JTable table;
}The problem is that the table isn't removed. When you choose another situation ( say Sit2), at first the table apparently is gone, but when you press with the mouse in the area it appeared earlier, it appears again. How do I succesfully remove the table from the panel? Removing the panel doesn't seem to be enough. Help is much appreciated...
Best regards
SchwartzIf you reuse the panel and scroll pane throughout the application,
instantiate them in the constructor, not in an often-called event
handler. In the event handler, you only do add/remove of the table
on to the panel. You can't remove the table from the container
which does not directly contain it.
if (arg.equals("Sit2")){
holdingPanel.remove(table);
holdingPanel.revalidate();
holdingPanel.repaint(); //sometimes necessary
} -
I have a website setup and running for at least a year. We just changed to a dedicated server and for some reason I am experiencing trouble with the header image of the general web. When I load the page the header is now loading behind the flash window and then on a second hit of the enter key will load to the top where it should be. This site has been up and running for almost a year, can't figure why the problem now. But need to know what I need to look at. The flash content has been there since the beginning too.
Any help would be appreciated.
I have a copy at http://www.nepa-alliance.org/index2.htm
Would appreciate any guidance. One more thing if I may. I ran it through the w3c validator and got a terrific amount of errors for the code "<", "&", "> in the various scripts in the head. It recommends replacing it with the "<" , & but won't this screw up the script.
Thanks for any help.
rakeekaChances are you site has always been this way but you were unaware of the extent to which your APDivs / Layers / code validation errors have tripped you up bigtime.
How APDivs work
http://apptools.com/examples/pagelayout101.php
Code Validation Tools
CSS - http://jigsaw.w3.org/css-validator/
HTML - http://validator.w3.org/
HTML & CSS Tutorials
http://w3schools.com/
Nancy O.
Alt-Web Design & Publishing
Web | Graphics | Print | Media Specialists
http://alt-web.com/
http://twitter.com/altweb
http://alt-web.blogspot.com -
Scrollbar problem with JTable.
Hi,
I have 45 columns in a JTable. Please remember this is customize, we can change the number of columns dynamically, at max they can be 2 columns.
i was having a problem with display the columns names in my Frame. I posted at http://forum.java.sun.com/thread.jspa?threadID=5167358&messageID=9641265#9641265
I got the solution. Thanks for that.
But as i said these columns are customized.
when i am having 2 columns in my JTable, table.setAutoResizeMode( JTable.AUTO_RESIZE_OFF ); is behaving differently, it's not occupying the complete JFrame. Lots of space is left out beside these 2 columns.
When i comment this line, then those 2 columns are occupying my complete Frame.
these two colmns should occupy my complete Frame and if i select 45 columns i should get scroll bar at botton with complete column NAMES.
Hope i am clear.
My Snippet
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.table.*;
import java.util.*;
public class SimpleTable extends JPanel {
private boolean DEBUG = false;
public SimpleTable() {
super(new BorderLayout());
String[][] values = new String[10][];
String[] columnNames = {
"First Name","Last Name","Sport","# of Years","Vegetarian","First Name","Last Name","Sport","# of Years","Vegetarian","First Name","Last Name","Sport","# of Years","Vegetarian","First Name","Last Name","Sport","# of Years","Vegetarian","First Name","Last Name","Sport","# of Years","Vegetarian","First Name","Last Name","Sport","# of Years","Vegetarian","First Name","Last Name","Sport","# of Years","Vegetarian","First Name","Last Name","Sport","# of Years","Vegetarian","First Name","Last Name","Sport","# of Years","Vegetarian"
Object[][] data = {
{"Mary", "Campione",
"Snowboarding", new Integer(5), new Boolean(false)},
{"Alison", "Huml",
"Rowing", new Integer(3), new Boolean(true)},
{"Kathy", "Walrath",
"Knitting", new Integer(2), new Boolean(false)},
{"Sharon", "Zakhour",
"Speed reading", new Integer(20), new Boolean(true)},
{"Philip", "Milne",
"Pool", new Integer(10), new Boolean(false)},
{"Mary", "Campione",
"Snowboarding", new Integer(5), new Boolean(false)},
{"Alison", "Huml",
"Rowing", new Integer(3), new Boolean(true)},
{"Kathy", "Walrath",
"Knitting", new Integer(2), new Boolean(false)},
{"Sharon", "Zakhour",
"Speed reading", new Integer(20), new Boolean(true)},
{"Philip", "Milne",
"Pool", new Integer(10), new Boolean(false)},
{"Mary", "Campione",
"Snowboarding", new Integer(5), new Boolean(false)},
{"Alison", "Huml",
"Rowing", new Integer(3), new Boolean(true)},
{"Kathy", "Walrath",
"Knitting", new Integer(2), new Boolean(false)},
{"Sharon", "Zakhour",
"Speed reading", new Integer(20), new Boolean(true)},
{"Philip", "Milne",
"Pool", new Integer(10), new Boolean(false)},
{"Mary", "Campione",
"Snowboarding", new Integer(5), new Boolean(false)},
{"Alison", "Huml",
"Rowing", new Integer(3), new Boolean(true)},
{"Kathy", "Walrath",
"Knitting", new Integer(2), new Boolean(false)},
{"Sharon", "Zakhour",
"Speed reading", new Integer(20), new Boolean(true)},
{"Philip", "Milne",
"Pool", new Integer(10), new Boolean(false)},
{"Mary", "Campione",
"Snowboarding", new Integer(5), new Boolean(false)},
{"Alison", "Huml",
"Rowing", new Integer(3), new Boolean(true)},
{"Kathy", "Walrath",
"Knitting", new Integer(2), new Boolean(false)},
{"Sharon", "Zakhour",
"Speed reading", new Integer(20), new Boolean(true)},
{"Philip", "Milne",
"Pool", new Integer(10), new Boolean(false)},
{"Mary", "Campione",
"Snowboarding", new Integer(5), new Boolean(false)},
{"Alison", "Huml",
"Rowing", new Integer(3), new Boolean(true)},
{"Kathy", "Walrath",
"Knitting", new Integer(2), new Boolean(false)},
{"Sharon", "Zakhour",
"Speed reading", new Integer(20), new Boolean(true)},
{"Philip", "Milne",
"Pool", new Integer(10), new Boolean(false)},
{"Mary", "Campione",
"Snowboarding", new Integer(5), new Boolean(false)},
{"Alison", "Huml",
"Rowing", new Integer(3), new Boolean(true)},
{"Kathy", "Walrath",
"Knitting", new Integer(2), new Boolean(false)},
{"Sharon", "Zakhour",
"Speed reading", new Integer(20), new Boolean(true)},
{"Philip", "Milne",
"Pool", new Integer(10), new Boolean(false)},
{"Mary", "Campione",
"Snowboarding", new Integer(5), new Boolean(false)},
{"Alison", "Huml",
"Rowing", new Integer(3), new Boolean(true)},
{"Kathy", "Walrath",
"Knitting", new Integer(2), new Boolean(false)},
{"Sharon", "Zakhour",
"Speed reading", new Integer(20), new Boolean(true)},
{"Philip", "Milne",
"Pool", new Integer(10), new Boolean(false)},
{"Mary", "Campione",
"Snowboarding", new Integer(5), new Boolean(false)},
{"Alison", "Huml",
"Rowing", new Integer(3), new Boolean(true)},
{"Kathy", "Walrath",
"Knitting", new Integer(2), new Boolean(false)},
{"Sharon", "Zakhour",
"Speed reading", new Integer(20), new Boolean(true)},
{"Philip", "Milne",
"Pool", new Integer(10), new Boolean(false)}
DefaultTableModel defaulttablemodel = new DefaultTableModel(data,columnNames);
final JTable table = new JTable(defaulttablemodel)
public boolean isCellEditable(int row,int column)
return false;
table.setPreferredScrollableViewportSize(new Dimension(500, 70));
//table.setAutoResizeMode( JTable.AUTO_RESIZE_OFF );
JScrollPane scrollPane = new JScrollPane(table);
add(scrollPane);
private static void createAndShowGUI() {
JFrame frame = new JFrame("SimpleTable");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
SimpleTable newContentPane = new SimpleTable();
newContentPane.setOpaque(true); //content panes must be opaque
frame.setContentPane(newContentPane);
frame.pack();
frame.setVisible(true);
public static void main(String[] args) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}Thank You camickr, it's serving my purpose.
Just for a clarrification :
table.setAutoResizeMode( JTable.AUTO_RESIZE_OFF );
table.setAutoscrolls(false);without using these lines also my purpose is serving.....then y do we need above two lines of code. r they necessary
i mean, this snippet is sufficient.
public boolean getScrollableTracksViewportWidth()
return getPreferredSize().width < getParent().getWidth();
} -
I have a problem with applying a custom renderer. I know the renderer works so thats not the problem. If I do like this:
DefaultTableModel aDefaultTableModel = new DefaultTableModel(data, columnNames);
it works. But if I do like this:
DefaultTableModel aDefaultTableModel;
aDefaultTableModel.setDataVector(data, columNames);
is doesn't, why?I think maybe it's not the renderer at all. It may be my custom TableModel thats causing problems. Now this doesn't work:
private JTable aTable;
private CustomTableModel aTableModel;
public MyProgram() {
aTableModel = new CustomTableModel();
aTable = new JTable(aTableModel);
aTableModel.setData(data, columnNames);
private class CustomTableModel {
private String[] columnNames = null;
private Object[][] data = null;
public CustomTableModel() {
columnNames = new String[0];
data = new Object[0][0];
... snip
public void setData(Object[][] data, String[] columnNames) {
this.data = data;
this.columnNames = columnNames;
fireTableDataChanged();
... snip
Now, why doesn't that setData method work?? -
Hi All,
I am facing some problems in JTable :
1) How to remove all lines between cells, neither i should have column nor row lines....there should not be any lines between any cell at all.
2) If i select a perticular cell, complete row is getting selected with a blue background, that should not happen at all.....row should not get select....
3) How to make a cell non editable.
Regards,
Ravi1) Read the API. Check out the set??? methods until you fine what you want
2) Read the API. Check out the methods that deal with row and column selection
3) Override isCellEditable(...) method of JTable or DefaultTableModel -
Hi there,
i've got a little problem with my ALV header. every time when i run my program and want to go back to the selection screen with the BACK-button i see my header again. so i've got to push the BACK-button again to get to the selection screen.
here's my alv-code
FORM TOP_OF_PAGE.
REFRESH header_itab[].
CLEAR wa_header.
wa_header-typ = 'H'.
* wa_header-key = 'ausw1'.
wa_header-info = text-001.
APPEND wa_header TO header_itab.
CLEAR wa_header.
IF radio1 = 'X'.
wa_header-typ = 'S'.
wa_header-key = 'Radiobutton1'.
wa_header-info = text-002.
APPEND wa_header TO header_itab.
CLEAR wa_header.
ELSEIF radio2 = 'X'.
wa_header-typ = 'S'.
wa_header-key = 'Radiobutton2'.
wa_header-info = text-003.
APPEND wa_header TO header_itab.
CLEAR wa_header.
ELSEIF radio3 = 'X'.
wa_header-typ = 'S'.
wa_header-key = 'Radiobutton3'.
wa_header-info = text-004.
APPEND wa_header TO header_itab.
CLEAR wa_header.
ELSEIF radio4 = 'X'.
wa_header-typ = 'S'.
wa_header-key = 'Radiobutton4'.
wa_header-info = text-005.
APPEND wa_header TO header_itab.
CLEAR wa_header.
ELSE.
wa_header-typ = 'S'.
wa_header-key = 'Radiobutton5'.
wa_header-info = text-006.
APPEND wa_header TO header_itab.
CLEAR wa_header.
ENDIF.
wa_header-typ = 'S'.
wa_header-key = 'Benutzer:'.
wa_header-info = sy-uname.
APPEND wa_header TO header_itab.
CLEAR wa_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = header_itab.
ENDFORM.
* FORM alv_füllen *
FORM alv_fuellen .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = my_repid
i_callback_top_of_page = 'TOP_OF_PAGE'
* i_grid_title = my_title
it_fieldcat = feldkatalog_itab
is_layout = gs_layout
* it_events = event_itab
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDFORM.
* FORM layout_allg_build *
FORM layout_allg_build.
gs_layout-zebra = 'X'.
gs_layout-colwidth_optimize = 'X'.
ENDFORM.
hope someone can help me.
regards tobiashi,
i tried some of your ideas but none helped my.
so here's my complete code
maybe this is helpful.
*& Report z_cd_tool_awdimaiob
REPORT z_cd_tool_awdimaiob.
* G L O B A L I N T E R N A L T A B L E S
DATA: BEGIN OF itab OCCURS 100,
status TYPE dimaiobpar-zstatus,
rtyp TYPE dimaiobpar-zrtyp,
zahlweg TYPE dimaiobpar-ezawe_x,
a_status TYPE i,
a_rtyp TYPE i,
a_partner TYPE i,
a_vertraege TYPE i,
END OF itab .
* G L O B A L D A T A
DATA: ok_code LIKE sy-ucomm,
wa_test_tab LIKE dimaiobpar,
my_title TYPE lvc_title,
my_repid LIKE sy-repid.
TYPE-POOLS: slis.
DATA: feldkatalog_itab TYPE slis_t_fieldcat_alv,
wa_feldkatalog TYPE slis_fieldcat_alv,
event_itab TYPE slis_t_event,
header_itab TYPE slis_t_listheader,
gs_layout TYPE slis_layout_alv,
alv_event TYPE slis_alv_event,
wa_header TYPE slis_listheader.
DATA: t_tab LIKE dimaiobpar.
*selection-screen
SELECTION-SCREEN: SKIP, BEGIN OF BLOCK test WITH FRAME TITLE text-010.
SELECT-OPTIONS: partner FOR t_tab-partner,
astatus FOR t_tab-zstatus.
SELECTION-SCREEN END OF BLOCK test.
*Radiobutton
SELECTION-SCREEN: SKIP, BEGIN OF BLOCK test2 WITH FRAME TITLE text-020.
PARAMETERS: radio1 RADIOBUTTON GROUP test DEFAULT 'X',
radio2 RADIOBUTTON GROUP test,
radio3 RADIOBUTTON GROUP test,
radio4 RADIOBUTTON GROUP test,
radio5 RADIOBUTTON GROUP test.
SELECTION-SCREEN END OF BLOCK test2.
* S T A R T - O F - S E L E C T I O N.
START-OF-SELECTION.
* Select-Abfrage
PERFORM select_data.
*END-OF-SELECTION.
* Feldkatalog fuellen.
PERFORM feldkatalog_fuellen .
* Feldkatalog übergeben
PERFORM alv_feldkatalog.
* ALV-Event
perform alv_event.
* Layout bestimmen.
PERFORM layout_allg_build.
* header aufbau
PERFORM top_of_page.
SORT itab.
my_title = 'Auswertung Dimaiobpar'.
my_repid = sy-repid.
PERFORM exit_program.
END-OF-SELECTION.
* ALV mit daten füllen
PERFORM alv_fuellen.
* FORM alv_event *
FORM alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = event_itab.
READ TABLE event_itab
WITH KEY name = 'TOP_OF_PAGE'
INTO alv_event.
IF sy-subrc EQ 0.
MOVE 'TOP_OF_PAGE' TO alv_event-form.
APPEND alv_event TO event_itab.
ENDIF.
ENDFORM.
* FORM alv_feldkatalog *
FORM alv_feldkatalog.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = my_repid
i_internal_tabname = 'ITAB'
i_inclname = my_repid
* i_bypassing_buffer = 'X'
CHANGING
ct_fieldcat = feldkatalog_itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDFORM.
* FORM header *
FORM top_of_page.
CLEAR wa_header.
wa_header-typ = 'H'.
* wa_header-key = 'ausw1'.
wa_header-info = text-001.
APPEND wa_header TO header_itab.
CLEAR wa_header.
IF radio1 = 'X'.
wa_header-typ = 'S'.
wa_header-key = 'Radiobutton1'.
wa_header-info = text-002.
APPEND wa_header TO header_itab.
CLEAR wa_header.
ELSEIF radio2 = 'X'.
wa_header-typ = 'S'.
wa_header-key = 'Radiobutton2'.
wa_header-info = text-003.
APPEND wa_header TO header_itab.
CLEAR wa_header.
ELSEIF radio3 = 'X'.
wa_header-typ = 'S'.
wa_header-key = 'Radiobutton3'.
wa_header-info = text-004.
APPEND wa_header TO header_itab.
CLEAR wa_header.
ELSEIF radio4 = 'X'.
wa_header-typ = 'S'.
wa_header-key = 'Radiobutton4'.
wa_header-info = text-005.
APPEND wa_header TO header_itab.
CLEAR wa_header.
ELSE.
wa_header-typ = 'S'.
wa_header-key = 'Radiobutton5'.
wa_header-info = text-006.
APPEND wa_header TO header_itab.
CLEAR wa_header.
ENDIF.
wa_header-typ = 'S'.
wa_header-key = 'Benutzer:'.
wa_header-info = sy-uname.
APPEND wa_header TO header_itab.
CLEAR wa_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = header_itab.
REFRESH header_itab.
ENDFORM.
* FORM alv_füllen *
FORM alv_fuellen .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = my_repid
i_callback_top_of_page = 'TOP_OF_PAGE'
* i_grid_title = my_title
it_fieldcat = feldkatalog_itab[]
is_layout = gs_layout
* it_events = event_itab
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDFORM.
* FORM layout_allg_build *
FORM layout_allg_build.
gs_layout-zebra = 'X'.
gs_layout-colwidth_optimize = 'X'.
ENDFORM.
* FORM feldkatalog_fuellen *
FORM feldkatalog_fuellen.
*Feldkatalog erstellen/füllen mit hilfe der if-schleife anhand des
*gewählten Radiobuttons
IF radio1 = 'X'.
CLEAR wa_feldkatalog.
wa_feldkatalog-fieldname = 'STATUS'.
wa_feldkatalog-seltext_m = 'Status'.
APPEND wa_feldkatalog TO feldkatalog_itab.
CLEAR wa_feldkatalog.
wa_feldkatalog-fieldname = 'RTYP'.
wa_feldkatalog-seltext_m = 'Rechungstyp'.
APPEND wa_feldkatalog TO feldkatalog_itab.
CLEAR wa_feldkatalog.
wa_feldkatalog-fieldname = 'A_RTYP'.
wa_feldkatalog-seltext_m = 'Anzahl Rechungstyp'.
APPEND wa_feldkatalog TO feldkatalog_itab.
ELSEIF radio2 = 'X'.
CLEAR wa_feldkatalog.
wa_feldkatalog-fieldname = 'RTYP'.
wa_feldkatalog-seltext_m = 'Rechungstyp'.
APPEND wa_feldkatalog TO feldkatalog_itab.
CLEAR wa_feldkatalog.
wa_feldkatalog-fieldname = 'A_STATUS'.
wa_feldkatalog-seltext_m = 'Anzahl Status'.
APPEND wa_feldkatalog TO feldkatalog_itab.
ELSEIF radio3 = 'X'.
CLEAR wa_feldkatalog.
wa_feldkatalog-fieldname = 'STATUS'.
wa_feldkatalog-seltext_m = 'Status'.
APPEND wa_feldkatalog TO feldkatalog_itab.
CLEAR wa_feldkatalog.
wa_feldkatalog-fieldname = 'RTYP'.
wa_feldkatalog-seltext_m = 'Rechungstyp'.
APPEND wa_feldkatalog TO feldkatalog_itab.
CLEAR wa_feldkatalog.
wa_feldkatalog-fieldname = 'A_VERTRAEGE'.
wa_feldkatalog-seltext_m = 'Anzahl Verträge'.
APPEND wa_feldkatalog TO feldkatalog_itab.
ELSEIF radio4 = 'X'.
CLEAR wa_feldkatalog.
wa_feldkatalog-fieldname = 'STATUS'.
wa_feldkatalog-seltext_m = 'Status'.
APPEND wa_feldkatalog TO feldkatalog_itab.
CLEAR wa_feldkatalog.
wa_feldkatalog-fieldname = 'RTYP'.
wa_feldkatalog-seltext_m = 'Rechungstyp'.
APPEND wa_feldkatalog TO feldkatalog_itab.
CLEAR wa_feldkatalog.
wa_feldkatalog-fieldname = 'A_PARTNER'.
wa_feldkatalog-seltext_m = 'Anzahl GPartner'.
APPEND wa_feldkatalog TO feldkatalog_itab.
ELSE.
CLEAR wa_feldkatalog.
wa_feldkatalog-fieldname = 'STATUS'.
wa_feldkatalog-seltext_m = 'Status'.
APPEND wa_feldkatalog TO feldkatalog_itab.
CLEAR wa_feldkatalog.
wa_feldkatalog-fieldname = 'RTYP'.
wa_feldkatalog-seltext_m = 'Rechungstyp'.
APPEND wa_feldkatalog TO feldkatalog_itab.
CLEAR wa_feldkatalog.
wa_feldkatalog-fieldname = 'ZAHLWEG'.
wa_feldkatalog-seltext_m = 'Zahlweg'.
APPEND wa_feldkatalog TO feldkatalog_itab.
CLEAR wa_feldkatalog.
wa_feldkatalog-fieldname = 'A_PARTNER'.
wa_feldkatalog-seltext_m = 'Anzahl GPartner'.
APPEND wa_feldkatalog TO feldkatalog_itab.
ENDIF.
ENDFORM.
* FORM select_data *
FORM select_data.
*select-abfrage mit hilfe der if-schleife, analog zum Feldkatalog
IF radio1 = 'X'.
* Radiobutton1: Rechungstypen je Satus
SELECT
zstatus AS status
zrtyp AS rtyp
COUNT( DISTINCT zrtyp ) AS a_rtyp
INTO CORRESPONDING FIELDS OF itab
FROM dimaiobpar
WHERE
insobject LIKE 'V%' AND
partner IN partner AND
zstatus IN astatus
GROUP BY ZSTATUS zrtyp
ORDER BY zstatus.
APPEND itab.
ENDSELECT.
ELSEIF radio2 = 'X'.
* Radiobutton2: Status je Rechungstyp.
SELECT
zrtyp AS rtyp
COUNT( DISTINCT zstatus ) AS a_status
INTO CORRESPONDING FIELDS OF itab
FROM dimaiobpar
WHERE
insobject LIKE 'V%' AND
partner IN partner AND
zstatus IN astatus
GROUP BY ZRTYP
ORDER BY zrtyp.
APPEND itab.
ENDSELECT.
ELSEIF radio3 = 'X'.
* Radiobutton3: Anzahl Verträge je Status und Rtyp.
SELECT
zstatus AS status
zrtyp AS rtyp
COUNT( DISTINCT insobject ) AS a_vertraege
INTO CORRESPONDING FIELDS OF itab
FROM dimaiobpar
WHERE
insobject LIKE 'V%' AND
partner IN partner AND
zstatus IN astatus
GROUP BY ZSTATUS zrtyp
ORDER BY zstatus.
APPEND itab.
ENDSELECT.
ELSEIF radio4 ='X'.
* Radiobutton4: Anzahl GPartner je Status und RTyp.
SELECT
zstatus AS status
zrtyp AS rtyp
COUNT( DISTINCT partner ) AS a_partner
INTO CORRESPONDING FIELDS OF itab
FROM dimaiobpar
WHERE
insobject LIKE 'V%' AND
partner IN partner AND
zstatus IN astatus
GROUP BY ZSTATUS zrtyp
ORDER BY zstatus zrtyp.
APPEND itab.
ENDSELECT.
ELSE.
* Radiobutton5: Anzahl Kunden nach Zahlweg.
SELECT
zstatus AS status
zrtyp AS rtyp
ezawe_x AS zahlweg
COUNT( DISTINCT partner ) AS a_partner
INTO CORRESPONDING FIELDS OF itab
FROM dimaiobpar
WHERE
insobject LIKE 'V%' AND
partner IN partner AND
zstatus IN astatus AND
ezawe_x IN ('E', 'F', space)
GROUP BY ZSTATUS zrtyp EZAWE_X
ORDER BY zstatus zrtyp.
APPEND itab.
ENDSELECT.
ENDIF.
ENDFORM.
* FORM EXIT_PROGRAM *
FORM exit_program.
IF sy-ucomm = 'BACK' OR
sy-ucomm = 'EXIT' OR
sy-ucomm = 'CANCEL'.
LEAVE PROGRAM.
endif.
ENDFORM. -
Problems with http header "Content-Location"
Does anyone know how to override the
"Content-Location" http header. We are having issues with search engines and this header being returned from Apache/oc4j. In a nutshell, I have a site that uses the
Struts framework, where the actual urls submitted would be for example
(http://mysite/home.do), where ".do" is just a servlet mapping. When we have
tried to follow the one link that has been spidered, it actually contains
the full path that appears in the "Content-Location" header (i.e.
http://mysite/web-inf/jsps/bogus.jsp) which in this case can't even be
accessed. The feedback we get from third-party utilities that try to spider
the site is that it is stopping because it has already indexed "bogus.jsp",
which in reality will always appear since it is a template, where the actual
urls will be different as is above.
Because the "Content-Location" header is being returned to any
client hitting the site, search engine spiders stop indexing at the first page because the value in "Content-Location" is the same.
Solutions tried:
mod_headers in Apache - have tried "Header unset"
HttpServletResponse.setHeader()
Any help would be appreciatedHi there,
i'm having a similar problem to this when trying to run some web page speed optimisation software...
i think the issue also causes problems with the Opera browser (although this may have been fixed in the latest version).
anybody any ideas how to stop the header being sent in the response?
many thanks,
Andy -
Problem with column heading sorting
I have a problem with a classic report.
I created a simple report. We want to sort the report, when we click the column heading. But when we cklick on the column heading, nothing happens. In firefox we get the error "apex.jQuery.datepicker is undefined".
When we created another simple report and connect against another database (but the same web-server), we can sort the report, when we cklick a column heading. On both databases we installed the same apex version (=4.0.1.00.03).
on "apex.oracle.com" (workspace:ama / user:demo / pwd:demo) I created an example.
what is wrong?? Can anyone help me ??
Thanks
RobertHi Jari,
yes, you are right. I changed my query. I attempted to find a solution and so I changed the query several times => I used other tables, with or without date columns, with or without columns in the select and so on.
You said, the problem is the authentication scheme. It crossed my mind that I do another change:
during the creation of my application apex created a login page => page 101. For my example application I don't need a login page, and so I droped the page. After starting the application I saw the error message "page 101 not found ". So I searched for a property where apex definies the "start page" respectively "login page". But I don't found anything. Then I looked into the export file and searched for "101". I found the package procedure "wwv_flow_api.create_auth_setup" and the parameter "p_invalid_session_page", which receive the value "101". In apex the property "Session Not Valid Page" was blank. So I inserted the page number "1" (=the first and sole page in my application).
After the explained changes I could start my report.
I don't know, whether these informations help to find the problem!
Regards
Robert -
Problem with JTable in a JScrollPane
Hello all,
I have a problem using JTable, that the number of columns is very big,
and the JScrollPane shows only vertical ScrollBar, isn't there any way to show a horizontal ScrollBar, to show the other columns without being bunched.
Thanks in advance.table.setAutoResizeMode( JTable.AUTO_RESIZE_OFF );
-
Flipping problems with JTables
I have a JTable (with scroll bar ) and a JButton inside a Jframe.
When I push the JButton another JFrame appears with another JTable inside.
The problem is that when I close the upper JFrame and I try to move the scroll bar of the JTable inside the father JFrame it starts to flip doing an horrible effect for the general lauyout.The solution it could be overwrite the paint method....but actually for my Java knowledges is impossibe. Help !Sorry I mean flashing problems (not flipping.)
The code is:
JPanel p1=new JPanel();
Label lab1=new Label(" LABORATORIO ANALISI CLINICHE");
Label lab2=new Label(" Dr.ssa xxxxxxxxxxxx ");
Label lab3=new Label(" C/o xxxxxxxxxxxxx ");
Label lab4=new Label(" Via xxxxxxxxxxx nr 5/7");
Label lab5=new Label(" 86100 xxxxxxxxxx");
Label lab6=new Label(" tel. xxxxxxxxxx");
p1.setLayout(new GridLayout(6,1));
p1.add(lab1);
p1.add(lab2);
p1.add(lab3);
p1.add(lab4);
p1.add(lab5);
p1.add(lab6);
Report myReport=new Report(tableModels[p.getSelectedIndex()],"Printer Manager",p1);
Actually Report is a class that prepare a JFrame with a JPanel and inside the JPanel there is a JScrollPane that get the JTable.That's the code for the Report class:
import javax.swing.*;
import javax.swing.table.*;
import java.awt.print.*;
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.awt.Dimension;
public class Report extends Frame implements Printable
JFrame frame;
JTable tableView;
JComponent component_dummy;
public Report(AbstractTableModel tableModel,String title,JComponent component)
super(title);
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) { dispose(); } } );
final String[] headers = {"Description", "open price",
"latest price", "End Date", "Quantity"};
final Object[][] data = {
{"Box of Biros", "1.00", "4.99", new Date(), new Integer(2)},
{"Blue Biro", "0.10", "0.14", new Date(), new Integer(1)},
{"legal pad", "1.00", "2.49", new Date(), new Integer(1)},
{"tape", "1.00", "1.49", new Date(), new Integer(1)},
{"stapler", "4.00", "4.49", new Date(), new Integer(1)},
{"legal pad", "1.00", "2.29", new Date(), new Integer(5)}
TableModel dataModel = new AbstractTableModel() {
public int getColumnCount() { return headers.length; }
public int getRowCount() { return data.length;}
public Object getValueAt(int row, int col) {
return data[row][col];}
public String getColumnName(int column) {
return headers[column];}
public Class getColumnClass(int col) {
return getValueAt(0,col).getClass();}
public boolean isCellEditable(int row, int col) {
return (col==1);}
public void setValueAt(Object aValue, int row, int column) {
data[row][column] = aValue;
dataModel=tableModel;
tableView = new JTable(dataModel);
// component_dummy= new JComponent();
component_dummy=component;
JScrollPane scrollpane = new JScrollPane(tableView);
scrollpane.setPreferredSize(new Dimension(600,300));
this.setLayout(new BorderLayout());
this.add(BorderLayout.NORTH,component);
this.add(BorderLayout.CENTER,scrollpane);
JButton printButton= new JButton();
printButton.setText("Stampa");
//this.getContentPane().add(BorderLayout.SOUTH,printButton);
this.add(BorderLayout.SOUTH,printButton);
// for faster printing turn double buffering off
RepaintManager.currentManager(
frame).setDoubleBufferingEnabled(false);
printButton.addActionListener( new ActionListener(){
public void actionPerformed(ActionEvent evt) {
PrinterJob pj=PrinterJob.getPrinterJob();
pj.setPrintable(Report.this);
pj.printDialog();
try{
pj.print();
}catch (Exception PrintException) {}
this.setVisible(true);
this.pack();
public int print(Graphics g, PageFormat pageFormat,
int pageIndex) throws PrinterException
Graphics2D g2 = (Graphics2D) g;
g2.setColor(Color.black);
int fontHeight=g2.getFontMetrics().getHeight();
int fontDesent=g2.getFontMetrics().getDescent();
//leave room for page number
double pageHeight = pageFormat.getImageableHeight()-fontHeight;
double pageWidth = pageFormat.getImageableWidth();
double tableWidth = (double) tableView.getColumnModel().getTotalColumnWidth();
double scale = 1;
if (tableWidth >= pageWidth)
scale = pageWidth / (tableWidth+(int)(pageWidth/2-pageWidth*0.43));
double headerHeightOnPage=
tableView.getTableHeader().getHeight()*scale;
double tableWidthOnPage=tableWidth*scale;
double oneRowHeight=(tableView.getRowHeight()+
tableView.getRowMargin())*scale;
int numRowsOnAPage=
(int)((pageHeight-headerHeightOnPage)/oneRowHeight);
double pageHeightForTable=oneRowHeight*numRowsOnAPage;
int totalNumPages= (int)Math.ceil((
(double)tableView.getRowCount())/numRowsOnAPage);
if(pageIndex>=totalNumPages)
return NO_SUCH_PAGE;
g2.translate(0f,0f);
g2.drawString("Laboratorio analisi Cliniche",(int)(pageWidth/2-pageWidth*0.33),
(int)(pageHeight+fontHeight-fontDesent-pageHeight*0.86));
g2.drawString("Dr.ssa xxxxxxxxx",(int)(pageWidth/2-pageWidth*0.33),
(int)(pageHeight+fontHeight-fontDesent-pageHeight*0.82));
g2.drawString("C/o xxxxxxxxxxxxxx",(int)(pageWidth/2-pageWidth*0.33),
(int)(pageHeight+fontHeight-fontDesent-pageHeight*0.78));
g2.drawString("Via xxxxxxxxxxx",(int)(pageWidth/2-pageWidth*0.33),
(int)(pageHeight+fontHeight-fontDesent-pageHeight*0.74));
g2.drawString("86100 xxxxxxxxx",(int)(pageWidth/2-pageWidth*0.33),
(int)(pageHeight+fontHeight-fontDesent-pageHeight*0.70));
g2.drawString("tel. 0874/316147-91720",(int)(pageWidth/2-pageWidth*0.33),
(int)(pageHeight+fontHeight-fontDesent-pageHeight*0.66));
// g2.translate(0f,headerHeightOnPage);
g2.translate((int)(pageWidth/2-pageWidth*0.33),-pageIndex*pageHeightForTable+(pageHeight+fontHeight-fontDesent-pageHeight*0.56));
//If this piece of the table is smaller than the size available,
//clip to the appropriate bounds.
if (pageIndex + 1 == totalNumPages)
int lastRowPrinted = numRowsOnAPage * pageIndex;
int numRowsLeft = tableView.getRowCount() - lastRowPrinted;
g2.setClip(0,(int)(pageHeightForTable * pageIndex),
(int) Math.ceil(tableWidthOnPage),
(int) Math.ceil(oneRowHeight * numRowsLeft));
//else clip to the entire area available.
else
g2.setClip(0, (int)(pageHeightForTable*pageIndex),
(int) Math.ceil(tableWidthOnPage),
(int) Math.ceil(pageHeightForTable));
g2.scale(scale,scale);
tableView.paint(g2);
g2.scale(1/scale,1/scale);
g2.translate(0,pageIndex*pageHeightForTable);
g2.translate(0, -headerHeightOnPage);
g2.setClip(0, 0,(int) Math.ceil(tableWidthOnPage),
(int)Math.ceil(headerHeightOnPage));
g2.scale(scale,scale);
tableView.getTableHeader().paint(g2); //paint header at top
return Printable.PAGE_EXISTS;
public static void main(String[] args)
do you think that there are problems because the print method ? or mayby because I clipped the graphics area ?
Maybe you are looking for
-
Bridge CC asks to Purge Cache but freezes when I try to do so
Am using Bridge on a MAC. Each time I open Bridge an error message comes up requesting to Purge Cache via preferences - But when I try to do this, it freezes. In fact, even before trying to purge cache, if I try navigating to another folder on Bridge
-
This has been happening for me just recently, 12/2012... EVERY TIME I CLICK ON A WEBSITE, I get: WARNING: SUSPECTED PHISHING SITE. At first, I thought it was valid, but when I saw that it was doing it before EVERY page, I knew that something was wron
-
Table name for Reason field in Details tab in CRMD_ORDER transaction
hi , kindly pls suggest me the table name for field Reason in Details tab of CRMD_ORDER transaction. thanks
-
Faxing from Oracle EBusiness Suit with XMLP-Do i need any third party Tool?
Hi All, We are having Oracle Apps 11.5.10.2 on Sun Solaris 5.8. We want to do faxing from our E Business Suit. I gone through the BLOG Entry for Faxing,where i found that i need to install CPUS. Can I installed CPUS on SUN Solaris? In the BLOG posted
-
External Activities (Service and non service), Primary Cost Activity
Hello All, 1. Need your help to understand the different in External Activity marked as servise and not marked as Service?? In what business scenario we use each of these?? 2. Can someone give me an example business scenario where we use Primary cost