Problem of selecting combobox in JTable!!
I click comboBox in jtable and choose one item
then move mouse away
and then click the comboBox again
It turns out to be strange:
the selectedItem of the comboBox changes the first item at once
I refered to the demo "TableRenderDemo.java" in http://java.sun.com/docs/books/tutorial/uiswing/components/example-swing/TableRenderDemo.java
I just wanna do things like that
but for some unknown reasons,I fail
I compared two codes but found nothing
here I'm giving a simple sample code. Refer this..
import javax.swing.*;
import java.awt.event.*;
import javax.swing.event.*;
import javax.swing.table.*;
import java.awt.*;
public class Class1 extends JFrame {
JScrollPane jScrollPane1 = new JScrollPane();
JTable editableTable1 = new JTable(3, 3);
public Class1() {
try {
JComboBox c = new JComboBox();
c.setEditable(true);
c.addItem("a");
c.addItem("b");
DefaultCellEditor cellEditor = new DefaultCellEditor(c);
TableColumn tc = editableTable1.getColumnModel().getColumn(0);
tc.setCellEditor(cellEditor);
this.getContentPane().setLayout(null);
jScrollPane1.setBounds(new Rectangle(25, 19, 330, 180));
this.getContentPane().add(jScrollPane1, null);
jScrollPane1.getViewport().add(editableTable1, null);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
System.exit(0);
} catch(Exception e) {
System.out.println("Exception in Class1:"+e);
public static void main(String[] args) {
Class1 class1 = new Class1();
class1.setSize(400, 400);
class1.setVisible(true);
Similar Messages
-
Problem with select all cells in JTable
Hi guys! I get some problem about selecting all cells in JTable. I tried to used two methods:
1> table.selectAll()2> changeSelection(firstcell, lastcell,false,true)
firstcell:[0,0], lastcell[rowcount-1,colcount-1]
Result: only the first row selected when i use both methods.
Note: i set up the selection model as following:
this.dataSheet.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
this.dataSheet.setCellSelectionEnabled(true);
this.dataSheet.setRowSelectionAllowed(true);
this.dataSheet.setColumnSelectionAllowed(true);Thanks !What selection properity should be changed in order to enable selectAll() method work properly? Is there Any constraints? Here is the TableModel I am using. And i set up selection mode use the following code:
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
table.setCellSelectionEnabled(true);
table.setRowSelectionAllowed(true);
table.setColumnSelectionAllowed(true);
import java.util.Vector;
import javax.swing.table.*;
import javax.swing.JTable;
public class DataSheetModel extends AbstractTableModel{
private Vector data = new Vector();//Store data
private Vector columnNames = new Vector();//Store head
public DataSheetModel(){}
public DataSheetModel(Vector headVector, Vector dataVector){
if(headVector != null) this.columnNames = headVector;
if(dataVector != null) this.data = dataVector;
public int getColumnCount(){
return columnNames.size()+1;
public int getRowCount(){
return data.size()+1;
public String getColumnName(int col){
if(col==0) return "";
else return (String)columnNames.get(col-1);
public Object getValueAt(int row, int col){
if(col==0) {
if(row != data.size()) return String.valueOf(row);
else return "*";
else{
if(row != data.size()){
Vector rowVector = (Vector)data.elementAt(row);
return rowVector.elementAt(col-1);
}else return null;
public void setValueAt(Object value, int row, int col){
if(row != this.data.size()){
Vector rowVector = (Vector)data.elementAt(row);
rowVector.set(col-1,value);
this.data.set(row,rowVector);
this.fireTableDataChanged();
}else{
Vector rowVector = new Vector();
for(int i=0; i<this.getColumnCount()-1; i++) rowVector.add(null);
rowVector.set(col-1,value);
this.data.add(rowVector);
this.fireTableDataChanged();
public Class getColumnClass(int c){
return getValueAt(0,c).getClass();
public boolean isCellEditable(int row, int col){
if(col == 0) return false;
else return true;
public void setDataVector(Vector head, Vector data){
if(head != null) this.columnNames = head;
if(data != null) this.data = data;
} -
Can any one help mee how to add combobox in jtable i am using Abstracttablemodel.
yes these the code where i am setting my editor and combobox
import java.sql.ResultSet;
import java.sql.*;
import java.util.*;
import javax.swing.JTable;
import javax.swing.table.TableCellRenderer;
import javax.swing.*;
import javax.swing.table.*;
import java.awt.*;
public class clsCustMast extends clsMSGen{
String strQuery,
querySrch1,
querySrch2;
String strTab1Rec;
String strTableName;
String []strTmp;
public clsValidate val;
public boolean flgInsrtTab1,
flgInsrtTab2,
flgErr;
public String strCmbFrom,
strCmbTo;
/* public JComboBox cmbRgn,
cmbCntry;*/
int intSlctdTab;
private int intCol,
rowCntTab1,
rowCntTab2;
final static int CNS_TAB1 = 0;
final static int CNS_TAB2 = 1;
final static String CNS_MANDT = "1";
final static boolean CNS_FALSE = false;
final static boolean CNS_TRUE = true;
final static String strUserPassword = "manager";
public void disp(){
super.disp();
flgInsrtTab1 = CNS_FALSE;
flgInsrtTab2 = CNS_FALSE;
// to get all region ids from the tble T_regionmast and populate it in the cmbReg to be displayed in the grid
populateRegionCntryCmb();
// to get all region ids from the tble T_countrymast and populate it in the cmbCntry to be displayed in the grid
//populateCntryCmb();
intCol = 0;
strQuery = "select a.f_custid,a.f_postcd,a.f_faxno,a.f_phoneno,a.f_regionid," +
" a.f_cntryid, a.f_delflag from t_custmast a,t_custtran b" +
" where a.f_custid = b.f_custid" +
" and b.f_langid = 'EN'";
//System.out.println(strQuery);
ResultSet Tab1Data = prcQuery(strQuery);
try{
ResultSetMetaData rmdTab1Dt = Tab1Data.getMetaData();
intCol = rmdTab1Dt.getColumnCount();
++intCol;
strTmp = new String[intCol+1];
//JButton btn1;
while (Tab1Data.next()){
String [] record = new String[intCol];
//Object [] record = new Object[intCol];
//btn1 = new JButton("C");
record[0] = new JButton("B").toString();
//record[0] = new Boolean(false);
for(int i=1; i<intCol; i++)
record= Tab1Data.getString(i);
if (i==1)
cmbFrom.addItem(record[i]);
cmbTo.addItem(record[i]);
// System.out.println(record[i]);
model1.addRow(record);
model1.fireTableChanged(null);
catch(SQLException ex)
System.out.println("Error1");
ex.printStackTrace();
strQuery = "select f_langid, b.f_custname, f_city, f_address " +
"from t_custmast a ,T_custtran b where " +
"a.f_custid = b.f_custid" +
" and b.f_langid = 'EN'";
ResultSet Tab2Data = prcQuery(strQuery);
try{
intCol = 0;
ResultSetMetaData rmdTab2Dt = Tab2Data.getMetaData();
intCol = rmdTab2Dt.getColumnCount();
while (Tab2Data.next()){
String [] record = new String[intCol];
for(int i=0; i<intCol;i++)
record[i]=Tab2Data.getString(i+1);
model2.addRow(record);
model2.fireTableChanged(null);
catch(SQLException ex)
System.out.println("Error2");
ex.printStackTrace();
System.out.println(intCol);
//Connect the database and Returns the resultset corresponding to passed query
public ResultSet prcQuery(String strQuery){
ResultSet resultQuery = dbCon.doQuery(strQuery);
return resultQuery;
public void populateRegionCntryCmb(){
cmbRgn = new JComboBox();
cmbCntry = new JComboBox();
String queryRgn = "select f_regionid,f_cntryid from t_regionmast";
ResultSet rsRgn = prcQuery(queryRgn);
//String[] items = { "one", "two", "three", "four" };
try{
while(rsRgn.next()){
//cmbRgn.addItem(rsRgn.getString(1));
cmbCntry.addItem(rsRgn.getString(2));
//System.out.println(rsRgn.getString(1)+ " " + rsRgn.getString(2));
}catch(SQLException ex)
{ System.out.println("Error in region cd retrieve");
ex.printStackTrace();
System.out.println(cmbCntry.getItemAt(0));
//cmbCntry = new JComboBox(items);
cmbCntry.setEditable( false );
DefaultCellEditor dceCmbCntry = new DefaultCellEditor( cmbCntry );
info_table.getColumnModel().getColumn(6).setCellEditor(dceCmbCntry);
// Set the first columm to use a ComboBox as a renderer
info_table.getColumnModel().getColumn(6).setCellRenderer(new clsComboBoxRenderer());
public void populateCntryCmb(){
cmbCntry = new JComboBox();
String queryCntry = "select f_reionid,f_cntryid from t_regionmast";
ResultSet rsCntry = prcQuery(queryCntry);
try{
if(!rsCntry.next()){
System.out.println("No Records in Country Master Table");
}else{
while(rsCntry.next()){
cmbCntry.addItem(rsCntry.getString(1));
//System.out.println(rsCntry.getString(1));
}catch(SQLException ex)
System.out.println("Error in region cd retrieve");
ex.printStackTrace();
System.out.println(cmbCntry.getItemAt(1));
cmbCntry.setEditable( false );
DefaultCellEditor dceCmbCntry = new DefaultCellEditor( cmbCntry );
info_table.getColumnModel().getColumn(6).setCellEditor(dceCmbCntry);
// Set the first columm to use a ComboBox as a renderer
info_table.getColumnModel().getColumn(6).setCellRenderer(new clsComboBoxRenderer());
class clsComboBoxRenderer extends JComboBox implements TableCellRenderer
public Component getTableCellRendererComponent
JTable info_table, Object value, boolean isSelected,
boolean hasFocus, int row, int column){
removeAllItems();
addItem( value );
return this;
public void add()
String strAdd1[],
strAdd2[];
intSlctdTab = tabbedPane.getSelectedIndex();
if ( intSlctdTab == CNS_TAB1){
if ( flgInsrtTab1 == CNS_FALSE && flgInsrtTab2 == CNS_FALSE){
rowCntTab1 = model1.getRowCount();
//add a new row for both tabs when the add button is pressed while tab1 is selected.
//Add a new row for the tab1
strAdd1 = new String[8];
model1.addRow(strAdd1);
model1.fireTableChanged(null);
flgInsrtTab1 = CNS_TRUE;
//Add a new row for the tab2
strAdd2 = new String[4];
model2.addRow(strAdd2);
model2.fireTableChanged(null);
flgInsrtTab2 = CNS_TRUE;
}else{
lblStatus.setText("Save the Records and then Add New one");
}else if(intSlctdTab == CNS_TAB2){
if ( flgInsrtTab2 = CNS_FALSE){
rowCntTab2 = model2.getRowCount();
//When a add button is pressed while selecting the 2nd tab add new row only to 2nd tab
strAdd2 = new String[4];
model2.addRow(strAdd2);
model2.fireTableChanged(null);
flgInsrtTab2 = CNS_TRUE;
}else{
lblStatus.setText("Save the Records and then Add New one");
public void save()
// Decalrion for varaibles in the TAB1
String strCustId,
strDelFlg,
strPostCd,
strFaxNo,
strPhNo,
strRgnId,
strCntryId;
boolean flag;
//Assigning the values of the selected row to the corresponding fields
strCustId = model1.getValueAt(rowCntTab1,1).toString();
strPostCd = model1.getValueAt(rowCntTab1,2).toString();
strFaxNo = model1.getValueAt(rowCntTab1,3).toString();
strPhNo = model1.getValueAt(rowCntTab1,4).toString();
strRgnId = model1.getValueAt(rowCntTab1,5).toString();
strCntryId = model1.getValueAt(rowCntTab1,6).toString();
strDelFlg = model1.getValueAt(rowCntTab1,7).toString();
flgErr = CNS_FALSE;
//Validation for mandatory field F_CUSTID
flag = clsValidate.mandt(CNS_MANDT,strCustId);
if (flag == CNS_FALSE){
lblStatus.setText("Please Enter Values for Cust Id Field");
flgErr = CNS_TRUE;
//Validation for Mandatory field F_DELFLAG
flag = clsValidate.mandt(CNS_MANDT,strDelFlg);
if (flag == CNS_FALSE){
lblStatus.setText("Please Enter Values for Delete Flag Field");
flgErr = CNS_TRUE;
// if no error occurs process the insert process
if (flgErr == CNS_FALSE){
String sqlInsrtT1;
sqlInstrtT1 = "Insert into t_custmast'" + ( "'" +
" f_custid,f_delflag,f_postcd,f_faxno,f_phoneno," +
"f_regionid,f_cntryid '" +) "'" +
"(strCustId,strDelFlg,strPostCd,strFaxNo,strPhNo,strRgnId,strCntryId)";
strTableName = "t_custmast";
// sqlInsrtT1 = "insert into t_custmast*/
/* StringBuffer InsertSQLT1 = new StringBuffer();
strTableName = "t_custmast";
InsertSQLT1.append("INSERT INTO " + strTableName );
InsertSQLT1.append(" VALUES (");
int colCntTab1 = model1.getColumnCount();
System.out.println(colCntTab1);
// for (int i=0; i < colCntTab1-1; i++) {
int i = 0;
System.out.println("Value at 2,1 " + model1.getValueAt(2,7));
/* while(i < colCntTab1){
System.out.println(" "+ i);
//System.out.print( model1.getValueAt(2,i));
// InsertSQLT1.append(model1.getValueAt(rowCntTab1,i));
InsertSQLT1.append(model1.getValueAt(2,i));
if ( i != colCntTab1-1) {
InsertSQLT1.append(",");
}else{
InsertSQLT1.append(");");
i++;
//InsertSQLT1.append(");");
// System.out.println( model1.getValueAt(rowCntTab1,7));
System.out.println(InsertSQLT1.toString());*/
public void delete(){}
public void cancel(){}
public void goTran(){}
public void Search(){
intSlctdTab = tabbedPane.getSelectedIndex();
if (intSlctdTab == CNS_TAB1 ){
System.out.println(intSlctdTab);
querySrch1 = "select a.f_custid,a.f_postcd,a.f_faxno,a.f_phoneno,a.f_regionid,"
+ " a.f_cntryid, a.f_delflag from t_custmast a,t_custtran b"
+ " where a.f_custid = b.f_custid"
+ " and b.f_langid = 'EN'"
+ " and a.f_custid between '" + strCmbFrom + "'"
+ " and '" + strCmbTo + "'";
searchCondnTab1(querySrch1);
intSlctdTab = 3;
if ( intSlctdTab == CNS_TAB2 ){
querySrch2 = "select f_langid, b.f_custname, f_city, f_address"
+ " from t_custmast a ,T_custtran b "
+ " where a.f_custid = b.f_custid"
+ " and b.f_langid = 'EN'"
+ " and a.f_custid between '" + strCmbFrom + "'"
+ " and '" + strCmbTo + "'";
searchCondnTab2(querySrch2);
intSlctdTab = 3;
public void cmbFromSrch(){
strCmbFrom = ((String)cmbFrom.getSelectedItem()).trim();
System.out.println("Combo1 : " + strCmbFrom);
public void cmbToSrch(){
strCmbTo = ((String)cmbTo.getSelectedItem()).trim();
System.out.println("Combo2 : "+ strCmbTo);
public void searchCondnTab1(String querySrch){
System.out.println("Tab1 : " + querySrch);
ResultSet rsSrchTab1 = prcQuery(querySrch);
try{
ResultSetMetaData rmdSrchTab1 = rsSrchTab1.getMetaData();
intCol = rmdSrchTab1.getColumnCount();
//increase the column count by one for the button
++intCol;
//remove all datas before fetching records according to the conditions
model1.vctData.removeAllElements();
//adding records to the vector after fetching the records
while (rsSrchTab1.next()){
String [] record1 = new String[intCol];
record1[0] = new JButton("B").toString();
for(int i=1; i<intCol;i++)
record1[i]= rsSrchTab1.getString(i);
model1.addRow(record1);
model1.fireTableChanged(null);
catch(SQLException ex)
System.out.println("Error3");
ex.printStackTrace();
public void searchCondnTab2(String querySrch){
System.out.println("Tab2 : " + querySrch);
ResultSet rsSrchTab2 = prcQuery(querySrch);
try{
ResultSetMetaData rmdSrchTab2 = rsSrchTab2.getMetaData();
intCol = rmdSrchTab2.getColumnCount();
//remove all datas before fetching records according to the conditions
model2.vctData.removeAllElements();
//adding records to the vector after fetching the records
while (rsSrchTab2.next()){
String [] record2 = new String[intCol];
for(int i=0; i<intCol;i++)
record2[i]= rsSrchTab2.getString(i+1);
model2.addRow(record2);
model2.fireTableChanged(null);
catch(SQLException ex)
System.out.println("Error4");
ex.printStackTrace();
public static void main(String args[]){
clsCustMast objCust = new clsCustMast();
objCust.strUserid = "SIVAGURU";
objCust.strTab1Name = "Basic";
objCust.strTab2Name = "Details";
objCust.strTitle = "Customer Maintenance";
objCust.Tran_code = "XD01";
objCust.strClsId = "clsCustMast";
objCust.strLangid = "EN";
objCust.connectDbase();
objCust.disp(); -
Use a button to select contents in Jtable
I have a jTable which holding a data list, I need two buttons, one is 'up' and one is 'down', to move selections in the jTable. The idea is if a client don't have a mouse, they can use these two buttons to navigate through the jTable.
Problem One: if the jTable is not selected, how can press a button make the first record been selected?
Problem Two: if the jTable is selected, how can press a button move the selection
I tried to mod ListSelectionModel, but I cannot find a method that does this. I thought if I can get this jTable selected (any record), I probably can move the selection by setting the selectionIndex or some...
Thank youDarryl.Burke wrote:
I'd still like to know how OP expects the clients to click a button without a mouse. Yes, I know about mnemonics, but if the clients did too, they should surely be able to work out the keyboard navigation as mentioned by WalterLaan.
db<sarcasm>
I know what he can do if their is no mouse.
OP can use the Robot class and keylisteners then move the mouse cursor according to which listener method is called and which key is responsible for the call.
I mean this is so brilliant, can you imagine how much money people will save on buying a mouse if this catches on.
I am telling you this is the future, say good by mouse your history now. Hahahaha
</sarcasm> -
Problem with "SELECT...FOR UPDATE OF..." and "POST command" combination
Problem in committing transactions in Multiple Forms (Oracle Forms) with POST built-in command:
Consider that the following statements are written in WHEN-WINDOW-CLOSED trigger of a called form.
Statements in called form (Form name: FORM_CHILD):
go_block('display_block') ;
do_key('execute_query') ;
-- Data from table_b will be populated in this block, based on the value of COLUMN_1 obtained
-- from TABLE_A.
-- Example: If the value of COLUMN_1 is 10, then all the matching records from TABLE_B, which
-- are inserted with value 10 in TABLE_B.COLUMN_1 will be fetched and shown here.
if user_choice = 'YES' then
commit ;
else
rollback ;
end if ;
Statements in calling forms:
There are two calling forms having following statements and it is going to call the above said called form.
CALLING FORM 1
Statements in KEY-COMMIT trigger:
post;
call_form(form_child, no_activate) ;
Statements in ON-INSERT trigger:
select column_1
from table_a
for update of column_1
where column_2 = 'X' ;
update table_a
set column_1 = column_1 + 1
where column_2 = 'X' ;
insert into table_b ...;
insert into table_b ...; Statements in KEY-COMMIT trigger:
post;
call_form(form_child, no_activate) ;
CALLING FORM 2:
Statements in ON-INSERT trigger:
select column_1
from table_a
for update of column_1
where column_2 = 'X' ;
update table_a
set column_1 = column_1 + 1
where column_2 = 'X' ;
insert into table_b ...;
insert into table_b ...;
insert into table_b ...;
Our understanding:
Assume that both the forms are running from two different machines/instances, issuing commit at the same time. In this case, forms will start executing the statements written in ON-INSERT trigger, the moment POST command is executed. Though the commit is issued at the same time, according to oracle, only one of the request will be taken for processing first. Assume that calling form 1 is getting processed first.
So, it fetches the value available in COLUMN_1 of TABLE_A and locks the row from further select, update, etc. as SELECT...FOR UPDATE command is used (note that NOWAIT is not given, hence the lock will be released only when COMMIT or ROLLBACK happens) and proceed executing further INSERT statements. Because of the lock provided by the SELECT...FOR UPDATE command, the statements in calling form 2 will wait for the resource.
After executing the INSERT statements, the FORM_CHILD is called. The rows inserted in to TABLE_A will be queried and shown. The database changes will be committed when user closes the window (as COMMIT is issued in its WHEN-WINDOW-CLOSED trigger). Then the SELECT...FOR UPDATE lock will be released and calling form 2's statements will be executed.
Actual happenings or Mis-behavior:
Calling form 2 starts executing INSERT statements instead of waiting for SELECT...FOR UPDATE lock. Also, the value selected from TABLE_A.COLUMN_1 is same in both the calling forms, which is wrong.
The rows inserted into TABLE_B are having similar COLUMN_1 values in calling form 2 and they are fetched and shown in the called form FORM_CHILD.
Note that in calling form 2 also POST only is issued, but the changes posted there are accessible in calling form 1 also, which is wrong.
Kindly suggest us as to how to fix above problem. It will be much use, if you can send us the information regarding the behavior of Oracle Forms POST built-in also.
Our mail ID: [email protected]
Thanks a lot in advance.You have several problems:
1. On-Insert will ONLY run if you have created a new record in a base-table block. If you haven't done that, then the POST command will not cause it to run.
2. Select for update without a "no wait" will lock records for the first form, but when the second form tries this, it will hit the ORA-00054 exception, and will NOT wait. The only way you could make it wait is to issue an UPDATE sql command, which is not such a good way to go.
All POST does is issues SQL insert or update commands for any changes the user has made to records in a form's base-table blocks, without following with a Commit command.
Also understand that Commit is the same as Commit_Form, and Rollback is the same as Clear_Form. You should read up on these in the Forms help topics. -
I'm having problems (1) selecting onscreen text, (2) resizing menu boxes and selecting menues with the cursor. I'm not able to select menus and move them. I'm not sure how to correct this.
1) This is because of software version 1.1. See this
thread for some options as to how to go back to 1.0,
which will correct the problem...
http://discussions.apple.com/thread.jspa?threadID=3754
59&tstart=0
2) This tends to happen after videos. Give the iPod a
minute or two to readjust. It should now be more
accurate.
3) This?
iPod shows a folder icon with exclamation
point
4) Restore the iPod
5) Try these...
iPod Only Shows An Apple Logo and Will Not Start
Up
iPod Only Shows An Apple Logo
I think 3,4, and 5 are related. Try the options I
posted for each one.
btabz
I just noticed that one of the restore methods you posted was to put it into Disk Mode First rather than just use the resstore straight off, I Have tried that and seems to have solved the problem, If it has thank you. previously I have only tried just restoring it skipping this extra step. Hope my iPod stays healthy, if it doesnt its a warrenty job me thinks any way thanks again -
Problem with selecting text in Adobe Reader XI
Hi all, I am encountering a problem with Adobe Reader XI and it is very strange I could not find an alike issue on the internet so I guess I have to submit a question with it.
So here it is, I am using Adobe Reader XI Version 11.0.2, operating system: Windows 7. I do not know it starts from when but it has the problem with selecting text - to be copied in pdf documents. I ensure that the documents are not scanned documents but word-based documents (or whatever you call it, sorry I cannot think of a proper name for it).
Normally, you will select the text/paragraph you want to copy and the text/paragraph will be highlighted, but the problem in this case that I cannot select the text/paragraph, the blinking pointer (| <-- blinking pointer) will just stays at the same location so I cannot select/highlight anything to be copied. It happens oftenly, not all the time but 90%.
This is very annoying as my work involves very much with copying text from pdf documents, I have to close the pdf file and then open it again so I can select the text but then after the first copying or second (if I am lucky), the problem happens again. For a few text I have to type it myself, for a paragraph I have to close all opening pdf documents and open again so I could select the paragraph to copy. I ran out of my patience for this, it causes trouble and extra time for me just to copying those texts from pdf documents. Does this problem happen to anyone and do you have a solution for this? I would much appreciate if you could help me out, thank you!Yeah, I totally agree, this is very strange. I have always been using Adobe Reader but this problem only occurred ~three months ago. It must be that some software newly installed I think. But I have no idea.
About your additional question, after selecting the texts and Ctrl + C, the texts are copied and nothing strange happens. It's just that right after I managed to copy the texts, it takes me a while to be able to select the texts again. For your information, I just tested to select the texts and then pressed Ctrl, the problem happened. And then I tried pressing C and then others letters, it all led to the problem.
I guess I have to stick with left-clicked + Copy until I/someone figure the source of this problem. Thanks a lot for your help! -
Problem with: select 'c' as X from dual
Problem with 'select 'c' as X from dual'
I get 2 different results when I execute the above with SQLPlus (or java) depending on the instance I am connected to. For one instance the result is a single character and for the other the character is padded with blanks to 32 chars in the SQLPlus window (and java). Does anyone know what database setting causes this to happen? Is it a version issue ?
Test #1: Oracle 9.2.0.6 - SQLPlus result is padded with blanks
SQL*Plus: Release 9.2.0.1.0 - Production on Mon Dec 10 09:27:58 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.6.0 - Production
SQL> select 'c' as X from dual;
X
c
SQL>
Test #2 Oracle 9.2.0.1 SQLPlus result is a single character.
SQL*Plus: Release 9.2.0.1.0 - Production on Mon Dec 10 09:29:27 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
SQL> select 'c' as X from dual;
X
c
SQL>Using 9.2.0.6 On AIX 5.2 I get the single byte result:
UT1 > select 'c' as X from dual;
X
c
If the databases are on different Oracle Homes you may want to check the sqlplus global logon files for any set commands.
If you executed the two sql statements from different OS directories you may also want to check your sqlpath for sqlplus .logon files.
Try issueing clear columns and repeating the statement. Are the results the same?
HTH -- Mark D Powell -- -
Problem in Selection Screen.
Dear Experts,
I am facing a problem in Selection Screen.
<b>I have 2 radio buttons ,</b>
<b>Radio Button 1</b> - Choosing the file from desktop and
<b>Radio Button 2</b> - Executing from Database
Under Option1 - i have a <b>FILE</b> parameter which is <b><u>Mandatory.</u></b>
Problem Case -
<b>when I choose option 2, Option 1 should be disabled. in the sense the file name which is mandatory here should not be mandatory . Currently, when i choose option 2 - i have to provide some dummy characters in the file parameter because the file parameter is mandatory, and <u><b>I want to avoid this.</b></u>
Please see the entire code .</b>
REPORT ZTEST.
DATA: LV_FILE_PATH(20) TYPE C.
DATA: LV_MASK(20) TYPE C VALUE ',*.XLS ,*.XLS. '.
*-- Macro to put radiobutton on selection screen
*-- &1 - radiobutton parameter name
*-- &2 - text element (description)
*-- &3 - radiobutton group
DEFINE MAKE_RADIOBUTTON.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: &1 RADIOBUTTON GROUP &3.
SELECTION-SCREEN COMMENT 3(60) &2.
SELECTION-SCREEN END OF LINE.
END-OF-DEFINITION.
SELECTION-SCREEN BEGIN OF BLOCK A0 WITH FRAME TITLE T000.
* From Config File
MAKE_RADIOBUTTON RB_1 ALL_DATA SRC.
SELECTION-SCREEN BEGIN OF BLOCK A1 WITH FRAME TITLE T001.
* Config file from Presentation server
PARAMETERS: P_FILE1 LIKE T390D-DBNAME OBLIGATORY. "
SELECTION-SCREEN END OF BLOCK A1.
* From database table
MAKE_RADIOBUTTON RB_2 INC_DOWN SRC.
SELECTION-SCREEN END OF BLOCK A0.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE1.
CALL FUNCTION 'WS_QUERY'
EXPORTING
QUERY = 'CD' "// Current Directory
IMPORTING
RETURN = LV_FILE_PATH.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
DEF_FILENAME = 'TA_DOWNLOAD.MDB'
DEF_PATH = LV_FILE_PATH
MASK = LV_MASK
MODE = 'O'
IMPORTING
FILENAME = P_FILE1
EXCEPTIONS
INV_WINSYS = 1
NO_BATCH = 2
SELECTION_CANCEL = 3
SELECTION_ERROR = 4
OTHERS = 5.
INITIALIZATION.
ALL_DATA = 'From Desktop : ? '.
INC_DOWN = 'From Database : ?'.
T000 = 'Configuration Upload'.
Please help
ThanksHi
You should do some modifications like these:
DEFINE MAKE_RADIOBUTTON_1.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: &1 RADIOBUTTON GROUP &3 USER-COMMAND &4.
SELECTION-SCREEN COMMENT 3(60) &2.
SELECTION-SCREEN END OF LINE.
END-OF-DEFINITION.
DEFINE MAKE_RADIOBUTTON_2.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: &1 RADIOBUTTON GROUP &3.
SELECTION-SCREEN COMMENT 3(60) &2.
SELECTION-SCREEN END OF LINE.
END-OF-DEFINITION.
SELECTION-SCREEN BEGIN OF BLOCK A0 WITH FRAME TITLE T000.
From Config File
MAKE_RADIOBUTTON_1 RB_1 ALL_DATA SRC AAA.
SELECTION-SCREEN BEGIN OF BLOCK A1 WITH FRAME TITLE T001.
Config file from Presentation server
PARAMETERS: P_FILE1 LIKE T390D-DBNAME MODIF ID FIL. "
SELECTION-SCREEN END OF BLOCK A1.
From database table
MAKE_RADIOBUTTON_2 RB_2 INC_DOWN SRC.
SELECTION-SCREEN END OF BLOCK A0.
AT SELECTION-SCREEN OUTPUT.
IF RB_2 = 'X'.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'FIL'.
SCREEN-ACTIVE = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
Max -
Performance problem with selecting records from BSEG and KONV
Hi,
I am having performance problem while selecting records from BSEG and KONV table. As these two tables have large amount of data , they are taking lot of time . Can anyone help me in improving the performance . Thanks in advance .
Regards,
PrashantHi,
Some steps to improve performance
SOME STEPS USED TO IMPROVE UR PERFORMANCE:
1. Avoid using SELECT...ENDSELECT... construct and use SELECT ... INTO TABLE.
2. Use WHERE clause in your SELECT statement to restrict the volume of data retrieved.
3. Design your Query to Use as much index fields as possible from left to right in your WHERE statement
4. Use FOR ALL ENTRIES in your SELECT statement to retrieve the matching records at one shot.
5. Avoid using nested SELECT statement SELECT within LOOPs.
6. Avoid using INTO CORRESPONDING FIELDS OF TABLE. Instead use INTO TABLE.
7. Avoid using SELECT * and Select only the required fields from the table.
8. Avoid nested loops when working with large internal tables.
9. Use assign instead of into in LOOPs for table types with large work areas
10. When in doubt call transaction SE30 and use the examples and check your code
11. Whenever using READ TABLE use BINARY SEARCH addition to speed up the search. Be sure to sort the internal table before binary search. This is a general thumb rule but typically if you are sure that the data in internal table is less than 200 entries you need not do SORT and use BINARY SEARCH since this is an overhead in performance.
12. Use "CHECK" instead of IF/ENDIF whenever possible.
13. Use "CASE" instead of IF/ENDIF whenever possible.
14. Use "MOVE" with individual variable/field moves instead of "MOVE-
CORRESPONDING" creates more coding but is more effcient. -
A problem highlighting/selecting text in Illustrator CS3
In several instances I can't highlight text to copy or to edit, other times it works fine. If I click the radio button for the text in layers (other layers may be locked to prevent accidental selection), the baselines appears and I should be able to highlight the text, but I can't. If I highlight some other unaffected area of text successfully (unlocked layers), sometimes it will allow me to select the problem text directly after. Then it will go back to being a problem, why?
I'm using the general text tool, I've locked the other sublayers to avoid accidentally selecting those items. Then I click the radio button on the sublayer I wish to edit or copy, which reveals the baselines. Then if I click within that object to highlight text with the cursor, the text tool creates a new textbox/sublayer and does not highlight the text I intended.
From: Monika Gause <[email protected]<mailto:[email protected]>>
Reply-To: <[email protected]<mailto:[email protected]>>
Date: Wed, 26 Oct 2011 14:49:40 -0600
To: Roger Daleiden <[email protected]<mailto:[email protected]>>
Subject: A problem highlighting/selecting text in Illustrator CS3
Re: A problem highlighting/selecting text in Illustrator CS3
created by Monika Gause<http://forums.adobe.com/people/Monika+Gause> in Illustrator - View the full discussion<http://forums.adobe.com/message/3992086#3992086 -
How to get the default selection color from JTable
Hi, there,
I have a question for how to get the default selection color from JTable. I am currently implementing the customized table cell renderer, but I do want to set the selection color in the table exactly the same of default table cell renderer. The JTable.getSelectionBackgroup() did not works for me, it returned dark blue which made the text in the table unreadable. Anyone know how to get the window's default selection color?
Thanks,
-JennyThe windows default selection color is dark blue. Try selecting any text on this page. The difference is that the text gets changed to a white font so you can actually see the text.
If you don't like the default colors that Java uses then use the UIManager to change the defaults. The following program shows all the properties controlled by the UIManager:
http://www.discoverteenergy.com/files/ShowUIDefaults.java
Any of the properties can be changed for the entire application by using:
UIManager.put( "propertyName", value ); -
Hi All,
I am Facing one problem in select query. My requirement is as follows.
User Screen will Have 4 Fileds.
Country Code, Zip Code From, Zip Code To, Delivery Area.
All are Parameter's only.
For Example ZTABLE having below Entries.
US 12345-6787 12345-6789 AKRON AKRON/CANTON
Once User try to create new entry by Click on SAVE, Below Possiblities are there.
Case 1: US 12345-6787 12345-6789 AKRON AKRON/CANTON ( Error Message)
Case 2: US 12345-6786 12345-6787 AKRON AKRON/CANTON ( Error Message)
Case 3: US 12345-6789 12345-6790 AKRON AKRON/CANTON ( Error Message)
Case 4: US 12345-6789 12345-6790 AKRON AKRON/CANTON ( Error Message)
Case 5: US 12345-6786 12345-6787 AKRON AKRON/CANTON ( Error Message)
Case 6: US 12345-6785 12345-6786 AKRON AKRON/CANTON ( Record Need To Insert)
Case 7: US 12345-6785 12345-6785 AKRON AKRON/CANTON ( Record Need To Insert)
Case 8: US 12345-6790 12345-6790 AKRON AKRON/CANTON ( Record Need To Insert)
Case 9: US 12345-6790 12345-6791 AKRON AKRON/CANTON ( Record Need To Insert)
Case 10: US 12345-6788 12345-6788 AKRON AKRON/CANTON ( Error Message)(This Condition is Failing)
Case 11: US 12345-6788 12345-6789 AKRON AKRON/CANTON ( Error Message)(This Condition is Failing)
In the above cases 10 and 11 is failing.
I am using the below select statment.
SELECT SINGLE * FROM zdt_sd_dlv_zcode WHERE mandt = sy-mandt
AND land1 = g_land1
AND ( post_code_from GE g_pbox_from AND post_code_from LE g_pbox_to )
OR ( post_code_to GE g_pbox_from AND post_code_to LE g_pbox_to ).
Friends can anyone give me some valuable inputs to solve this problem.
Points will reward.
Thanks in Advance,
Srinivas.Please use Select-options instead of Parameters so that you can use complex "and" and "or" in your select statements.
for eg:if you are declaring parameters like this below.
parameters post_code1 LIKE adrc-post_code1.
change to
select-options post_code1 for adrc-post_code1 no intervals.
siddu -
I have a problem in select-options
hi frns,
i am facing a big problem in select-options
the requirement is such that
i have 2 select-options
one for matnr and the other for maktx
so wen the clent select matnr with f4
in the maktx the similar description should come by using f4
pls help me outhi,
TYPES DECLARATION
types: begin of tp_marc,
matnr type marc-matnr,
werks type marc-werks,
end of tp_marc.
INTERNAL TABLE AND WORK AREA DECLARATION
data: t_marc type standard table of tp_marc,
wa_marc type tp_marc.
data : dd like table of dselc with header line. "*--- IMPORTANT
data : ft like table of dfies with header line.
data : t_makt like table of makt with header line.
parameters : matnr like makt-matnr .
parameters : maktx like makt-maktx.
at selection-screen output.
loop at screen.
if screen-name = 'MAKTX'.
screen-input = 0.
modify screen.
endif.
endloop.
at selection-screen on value-request for matnr.
SELECT matnr maktx FROM makt INTO TABLE makt up to 500 rows.
select *
from makt
up to 500 rows
into table t_makt
where spras = syst-langu.
if sy-subrc <> 0.
message 'INVALID MATERIAL NUMBER' type 'E'.
endif.
IMPORTANT
refresh dd.
dd-fldname = 'MATNR'.
dd-dyfldname = 'MATNR'.
append dd.
dd-fldname = 'MAKTX'.
dd-dyfldname = 'MAKTX'.
append dd.
*------- IMPORTANT
refresh ft.
ft-tabname = 'MAKT'.
ft-fieldname = 'MATNR'.
append ft.
ft-tabname = 'MAKT'.
ft-fieldname = 'MAKTX'.
append ft.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
ddic_structure = 'T001' "*----- IMPORTANT IF STANDARD STRUCT
retfield = 'MATNR'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'MATNR'
value_org = 'S'
tables
field_tab = ft "*---- IMPORTANT
value_tab = t_makt
dynpfld_mapping = dd "* IMPORTANT
exceptions
parameter_error = 1
no_values_found = 2
others = 3.
start-of-selection.
select matnr
werks
from marc
into table t_marc
where matnr = matnr.
if sy-subrc <> 0.
message :'no results IN MARC' type 'E'.
endif.
write: at 1(36) sy-uline.
format intensified on color = 7.
new-line.
write :sy-vline,at 10 'MATERIAL NUMBER',at 29 sy-vline, at 30 'PLANT',sy-vline.
new-line.
write: at 1(36) sy-uline.
format intensified off color = 4.
loop at t_marc into wa_marc.
new-line.
write :sy-vline,at 10 wa_marc-matnr ,sy-vline, at 30 wa_marc-werks, at 36 sy-vline.
endloop.
new-line.
write: at 1(36) sy-uline.
reward points if useful.
regards,
Vinod Samuel. -
Hi, everyone.
I have a problem in selecting records. In this case, I want to select records from database
LFA1,and the components of this table are LIFNR,ERDAT,LOEVM ,and so on.The type of LIFNR is char(10).There is a internal table:tab_cdhdr , the elements of tab_cdhdr are: objectid,udate and change_ind.The type of objectid is char(50).
And the select-rule is that: LIFNR = objectid. So I write like this:
select lifnr
erdat
loevm
form lfa1
into tab_lfa1
for all entries in tab_cdhdr
where lfa1 = tab_cdhdr-objectid+0(10).
But there is a warning: When using FOR ALL ENTRIES IN the specifyed length for "OBJECTID" is ignored in this condition.
Can you help me to solve this problem?
Thanks.Hi Feng..
If you dont want to change the Internal table TAB_CDHDR, Then declare another internal table (TEMPTAB_CDHDR.) with the same structure but Objectid with only 10 chars.
IF TAB_CDHDR[] IS NOT INITIAL.
LOOP AT TAB_CDHDR.
MOVE-CORRESPONDING TAB_CDHDR TO TEMPTAB_CDHDR.
APPEND TEMPTAB_CDHDR.
ENDLOOP.
select lifnr
erdat
loevm
form lfa1
into tab_lfa1
for all entries in tab_cdhdr
where lfa1 = TEMPtab_cdhdr-objectid.
ENDIF.
Sure ... this will work for u.....
REWARD IF HELPFUL.
Maybe you are looking for
-
Clearing of Open items (per Vendor)
Hi All, I would like to ask if there is a way to show multiple line items of a single vendor as multiple line items and not the sum of these line items during clearing in F-04. Right now, when clearing multiple line items of a single vendor, these li
-
How to turn off brush size dialog when holdng stylus on tablet.
Yesterday I signed up to try the latest version of Photoshop (CC) from previously working in CS6. There is a new behavior that when I hold down my stylus for more than a half-second or so on my tablet, a swirling circle icon appears and then a floati
-
Eye TV won't recognise MAC USB 2.0
Eye TV won't recognise MAC USB as USB 2.0. All latest sowtware updates have been installed. I have reset PRAM.
-
Mathscript null values in matrix
Dear Forum members, Is there a command or method within MathScript of finding the range of rows within a matrix that contain all zeros. Example below shows a (5 x 3) matrix W: | 1 2 3 | | 4 5 6 | | 0 0 0 | = W | 0 0
-
Random page breaks striping down my page. Anyone have a thought on a fix?
Ack! Randomly, some InDesign pages are filled with what look like page breaks that stripe through the page. Scrolling up and down sometimes removes them, sometimes reveals them as gray or white stripes. The footer keeps repeating or sometimes just a