Doubt in alv classes program
plz check the following code using class. i want to display the output. i have declared an instance called pav1. im getting short dump. wht i have to give in 'i_parent = ' int his case.
DATA:PAV1 TYPE REF TO CL_GUI_ALV_GRID.
tables:mara.
data:begin of itab occurs 0,
matnr like mara-matnr,
mtart like mara-mtart,
matkl like mara-matkl,
end of itab.
PARAMETERS: s_matnr LIKE mara-matnr.
INTIALIZATION EVENT
initialization.
MOVE '38' TO S_MATNR.
*move '38' to s_matnr-low.
*append s_matnr.
*move '679' to s_matnr-high.
*append s_matnr.
*AT SELECTION SCREEN EVENT.
at selection-screen.
IF S_MATNR NE '38'.
MESSAGE i000.
ENDIF.
*START OF SELECTION EVENT
start-of-selection.
select matnr mtart matkl from mara into corresponding fields of table
itab where matnr = s_matnr.
IF SY-SUBRC NE 0.
WRITE:/ 'SORRY'.
ENDIF.
*TOP OF PAGE EVENT
top-of-page.
write:/ 'TOP OF PAGE'.
*END OF SELECTION EVENT
END-OF-SELECTION.
WRITE:/'SELECTION ENDED.'.
create object pav1 exporting i_parent = mara.
CALL METHOD PAV1->set_table_for_first_display
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME = 'mara'
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
IS_LAYOUT =
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
CHANGING
it_outtab = itab[].
IT_FIELDCATALOG =
IT_SORT =
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
others = 4
IF sy-subrc ne 0.
write:/ 'sorry u didnt call the method correctly'.
ENDIF.
You have to create a object for custom container for the class cl_gui_custom_container.Then you have to give the i_parent for the ALV class object as <custom container object>
create object <custom container>
create object <alv grid>
importing i_parent = <custom container>.
Similar Messages
-
public class Outer
public static void main(String argv[])
Outer o=new Outer(); //1
Inner i =o.new Inner(); //2
//Inner i =new Inner(); //3
i.showName();
public class Inner{
void showName()
System.out.println("hi");
}//End of Inner class
}I have few doubt regrd the above program..
1)when i create an inner class instance as in line 3,..Iam having an err like
non-static variable this cannot be referenced from a static context.. Bcas Inner is a non static member of class Outer it cant be referred without an instance of Outer as in line 2.. But my doubt is why it doesnt give such error (of static context issue) in the case of line 1...its a silly dbt but iam confused ...
2..Can we refer the inner class without outer class like in line 2., I have used
Inner without Outer ..is this ok... or shuld we use as
Outer.Inner i =o.new Inner(); //2
3)In the above line We r associating the instance of inner class with the instance of outer class and the type of inner class with the type of outer class (Outer.Inner )..wht does this mean..
can anyone pls help me understand this..
thnx.
mysha..public class Outer
public static void main(String argv[])
Outer o=new Outer(); //1
er o=new Outer(); //1
Inner i =o.new Inner(); //2
//Inner i =new Inner(); //3
i.showName();
public class Inner{
void showName()
System.out.println("hi");
}//End of Inner class
}I have few doubt regrd the above program..
1)when i create an inner class instance as in line
3,..Iam having an err like
non-static variable this cannot be referenced from a
static context.. Bcas Inner is a non static member of
class Outer it cant be referred without an instance
of Outer as in line 2.. But my doubt is why it doesnt
give such error (of static context issue) in the case
of line 1...its a silly dbt but iam confused ...
Static methods of a class exist as soon as Java loads the class. Regular, or non-static, methods of a class belong to an object and only come into existence after you create an object of the class. Regular methods are called by an object. Static members are called using the class name.
Now, examine this simple program:
class Apple
private String color;
public Apple(String color)
this.color = color;
public void show()
System.out.println("apple color: " + color);
public static void greeting()
System.out.println("Hello from the Apple class.");
public class Demo
public static void main(String[] args)
Apple.greeting(); //1
Apple a = new Apple("red"); //2
}After the Apple class loads, any static methods in the class exist. Since greeting() is a static method of the Apple class, it can be called in line 1 before any Apple objects exist. But, what about line 2? How can the Apple constructor with the String parameter, which is a method in the Apple class, be called? The constructor isn't declared as a static, so it shouldn't exist in that regard, and no objects of the class exist. So, when and how did the constructor come into existence. That seems to be the question you're struggling with. I think the answer is: a constructor sort of acts like a static method. In order to be able to call a constructor, the constructor must exist as soon as the class loads and before any objects exist. The result is, you can call a constructor at any time.
I think your example is similar to my example, but you only have one class:
public class Outer
public static void main(String argv[])
Outer o=new Outer(); //1
}After Java loads Outer, any static methods in Outer exist. Since main() is a static method, it exists. Subsequently, java calls the static main() method to begin execution of your program. In line 1, you call the default constructor for Outer. The default constructor isn't static, so it shouldn't exist, but just like the constructor in my example above, the default constructor acts like a static method, and therefore you can call it without getting an error.
Inner i =o.new Inner(); //2
2..Can we refer the inner class without outer class
like in line 2., I have used
Inner without Outer ..is this ok... or shuld we use
as
Outer.Inner i =o.new Inner(); //2
I'm not sure what the difference is. In both cases you end up with an object that was created with the expression:
o.new Inner()
you just have a different type for your object, i.e. Outer.Inner versus Inner.
3)In the above line We r associating the instance of
inner class with the instance of outer class and the
type of inner class with the type of outer class
(Outer.Inner )..wht does this mean..
can anyone pls help me understand this..
I think you said it: it means you have an Inner object that is "associated" with an Outer object. Like any other regular member in the Outer class, Inner can refer to any members of Outer. (A static member of Outer can't refer to regular members of Outer because static members exist before any objects exist, and when no objects exist, the regular members don't exist.) That means an Outer object must exist before you can create an Inner object. -
CALL METHOD go_grid->set_table_for_first_display
EXPORTING i_structure_name = 'SFLIGHT'
CHANGING it_outtab = gi_sfligt
iam new to alv class, plss help
i want to know how will i get the class method go_grid?
do i have to click on pattern?
can anyone tell me the steps...to call the
class method set_table_for_first_display?
its urgent do replyHai Chauhan
Check the following Code
REPORT ZALV_SALES_HEADER_DETAIL MESSAGE-ID Z50650(MSG) .
TABLES
TABLES: VBAK . "SALES DOCUMENT HEADER
DATA OBJECTS DECLARATION
DATA: IT_VBAK TYPE STANDARD TABLE OF ZVBAK_STRUC,
IT_VBAP TYPE STANDARD TABLE OF ZVBAP_STRUC,
GS_LAYOUT TYPE LVC_S_LAYO,
GS1_LAYOUT TYPE LVC_S_LAYO,
GRID TYPE REF TO CL_GUI_ALV_GRID,
CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
VBAK_CONTAINER TYPE REF TO CL_GUI_CONTAINER,
VBAP_CONTAINER TYPE REF TO CL_GUI_CONTAINER,
WA_VBAK LIKE LINE OF IT_VBAK,
WA_VBAP LIKE LINE OF IT_VBAP,
SPLITTER TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
TOP_OF_PAGE_CONTAINER TYPE REF TO CL_GUI_CONTAINER,
GRID_VBAP TYPE REF TO CL_GUI_ALV_GRID,
TOP_PAGE TYPE REF TO CL_DD_DOCUMENT,
FLAG(1).
*"EVENT RECIEVER CLASS DEFINITION
CLASS LCL_EVENT_RECIEVER DEFINITION DEFERRED.
DATA: OBJ_EVENT TYPE REF TO LCL_EVENT_RECIEVER.
SELECTION-SCREEN
SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN.
PARAMETERS: P_VBTYP LIKE VBAK-VBTYP DEFAULT 'C'.
SELECTION-SCREEN: END OF BLOCK B1.
CLASS DEFINITION AND DECLARATIONS
CLASS LCL_EVENT_RECIEVER DEFINITION.
PUBLIC SECTION.
EVENTS:DOUBLE_CLICK,
TOP_OF_PAGE.
METHODS:HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW .
METHODS: HANDLE_TOP_OF_PAGE FOR EVENT TOP_OF_PAGE OF CL_GUI_ALV_GRID.
ENDCLASS. "LCL_EVENT_RECIEVER DEFINITION
CLASS LCL_EVENT_RECIEVER IMPLEMENTATION
CLASS LCL_EVENT_RECIEVER IMPLEMENTATION.
METHOD: HANDLE_DOUBLE_CLICK.
READ TABLE IT_VBAK INDEX E_ROW-INDEX INTO WA_VBAK.
PERFORM FETCH_ITEM_DETAILS USING WA_VBAK.
PERFORM ALV_GRID.
ENDMETHOD. "HANDLE_DOUBLE_CLICK
METHOD: HANDLE_TOP_OF_PAGE.
CALL METHOD TOP_PAGE->ADD_TEXT
EXPORTING
TEXT = 'SALES HEADER & ITEM DETAILS'.
CALL METHOD TOP_PAGE->DISPLAY_DOCUMENT
EXPORTING
PARENT = TOP_OF_PAGE_CONTAINER.
ENDMETHOD. "HANDLER_TOP_OF_PAGE
ENDCLASS. "LCL_EVENT_RECIEVER IMPLEMENTATION
AT SELECTION-SCREEN
AT SELECTION-SCREEN.
IF S_VBELN IS NOT INITIAL.
SELECT COUNT(*)
FROM VBAK
WHERE VBELN IN S_VBELN.
IF SY-DBCNT = 0.
MESSAGE E000 WITH 'NO TABLE ENTRIES FOUND FOR LOW KEY SPECIFIED'.
ENDIF.
ENDIF.
START-OF-SELECTION.
START-OF-SELECTION.
PERFORM FETCH_SALES_HEADER_RECORD.
PERFORM CREATE_CALL. "CREATION OF OBJECTS & CALLING METHODS
END-OF-SELECTION.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'ZSTATUS'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Form FETCH_SALES_HEADER_RECORD
text
--> p1 text
<-- p2 text
FORM FETCH_SALES_HEADER_RECORD .
SELECT
VBELN
AUDAT
VBTYP
AUART
AUGRU
NETWR
WAERK
FROM VBAK
INTO CORRESPONDING FIELDS OF TABLE IT_VBAK
WHERE VBELN IN S_VBELN
AND VBTYP = P_VBTYP.
ENDFORM. " FETCH_SALES_HEADER_RECORD
*& Form CREATE_CALL
text
--> p1 text
<-- p2 text
FORM CREATE_CALL .
IF CUSTOM_CONTAINER IS INITIAL.
CREATE OBJECT CUSTOM_CONTAINER
EXPORTING
PARENT =
CONTAINER_NAME = 'CUSTOM_CONTAINER'
STYLE =
LIFETIME = lifetime_default
REPID =
DYNNR =
NO_AUTODEF_PROGID_DYNNR =
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5
OTHERS = 6
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT SPLITTER
EXPORTING
TOP = 5
PARENT = CUSTOM_CONTAINER
ROWS = 3
COLUMNS = 1
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD SPLITTER->GET_CONTAINER
EXPORTING
ROW = 1
COLUMN = 1
RECEIVING
CONTAINER = TOP_OF_PAGE_CONTAINER.
CALL METHOD SPLITTER->GET_CONTAINER
EXPORTING
ROW = 2
COLUMN = 1
RECEIVING
CONTAINER = VBAK_CONTAINER.
CALL METHOD SPLITTER->GET_CONTAINER
EXPORTING
ROW = 3
COLUMN = 1
RECEIVING
CONTAINER = VBAP_CONTAINER.
CREATE OBJECT GRID
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
I_PARENT = VBAK_CONTAINER
I_APPL_EVENTS = space
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
GS_LAYOUT-GRID_TITLE = 'SALES HEADER DETAILS.'(100).
CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME = 'ZVBAK_STRUC'
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
IS_LAYOUT = GS_LAYOUT
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
CHANGING
IT_OUTTAB = IT_VBAK
IT_FIELDCATALOG =
IT_SORT =
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
CREATE OBJECT OBJ_EVENT .
SET HANDLER OBJ_EVENT->HANDLE_DOUBLE_CLICK FOR GRID.
SET HANDLER OBJ_EVENT->HANDLE_TOP_OF_PAGE FOR GRID.
CREATE OBJECT TOP_PAGE
EXPORTING
STYLE = 'ALV_GRID'
CALL METHOD TOP_PAGE->INITIALIZE_DOCUMENT.
CALL METHOD GRID->LIST_PROCESSING_EVENTS
EXPORTING
I_EVENT_NAME = 'TOP_OF_PAGE'
I_DYNDOC_ID = TOP_PAGE.
CALL SCREEN 100.
ENDFORM. " CREATE_CALL
*& Module USER_COMMAND_0100 INPUT
text
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form FETCH_ITEM_DETAILS
text
--> p1 text
<-- p2 text
FORM FETCH_ITEM_DETAILS USING WA_VBAK TYPE ZVBAK_STRUC .
SELECT
VBELN
POSNR
MATNR
MATWA
PMATN
CHARG
FROM VBAP
INTO TABLE IT_VBAP
WHERE VBELN = WA_VBAK-VBELN.
IF SY-SUBRC <> 0.
MESSAGE E000 WITH 'NO RECORDS FOUND FOR SPECIFIED KEY'.
ENDIF.
ENDFORM. " FETCH_ITEM_DETAILS
*& Module STATUS_0200 OUTPUT
text
MODULE STATUS_0200 OUTPUT.
SET PF-STATUS 'ZSTATUS'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0200 OUTPUT
*& Module USER_COMMAND_0200 INPUT
text
MODULE USER_COMMAND_0200 INPUT.
CASE SY-UCOMM.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0200 INPUT
*& Form alv_grid
text
--> p1 text
<-- p2 text
FORM ALV_GRID .
IF FLAG = ''.
FLAG = 'X'.
CREATE OBJECT GRID_VBAP
EXPORTING
I_SHELLSTYLE = 0
I_LIFETIME =
I_PARENT = VBAP_CONTAINER
I_APPL_EVENTS = space
I_PARENTDBG =
I_APPLOGPARENT =
I_GRAPHICSPARENT =
I_NAME =
EXCEPTIONS
ERROR_CNTL_CREATE = 1
ERROR_CNTL_INIT = 2
ERROR_CNTL_LINK = 3
ERROR_DP_CREATE = 4
others = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
GS1_LAYOUT-GRID_TITLE = 'SALES ITEM DETAILS.'(100).
CALL METHOD GRID_VBAP->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_BUFFER_ACTIVE =
I_BYPASSING_BUFFER =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME = 'ZVBAP_STRUC'
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
IS_LAYOUT = GS1_LAYOUT
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
CHANGING
IT_OUTTAB = IT_VBAP
IT_FIELDCATALOG =
IT_SORT =
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
OTHERS = 4
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " alv_grid
Thanks & regards
Sreenivasulu P -
"AT END OF" in Class Programming
Hi,
I want to know how to handle the following situation in ABAP within Class programming,
DATA : BEGIN OF LCL_TRAN OCCURS 0,
TRAN TYPE STRING
END OF LCL_TRAN.
DATA : BEGIN OF LCL_PROD OCCURS 0,
PROD TYPE STRING,
END OF LCL_PROD.
DESCRIBE TABLE LCL_PROD LINES I_PROD.
LOOP AT LCL_MAIN.
READ TABLE LCL_PROD WITH KEY PROD = LCL_MAIN-PROD.
IF SY-SUBRC = 0.
I_MAIN = I_MAIN + 1.
ENDIF.
AT END OF TRAN.
IF I_MAIN = I_PROD.
// I will do the necessary action here
ENDIF.
ENDAT.
ENDLOOP.
At end of each transaction(Tran) which is a item level data i want to do some action. I need AT END OF statement to handle this situation.
How to handle this situation in CLASS (SE24)?
Thank you
Arun PrasadHi arun,
classes basically we define for the purpose of <b>Encapsulation</b> principle of object oriented programming.
So as BSP supports strongly Object Oriented Concept, so whatever logic we are implementing we will try to implement in class only.
i have little doubt about what u asked, but still what i understand is that u like to know how to call the methods of a class from the BSP page, if this is the case, then ok, otherwise please let me know in detail.
now i am assumming that i understand ur problem properly, so this is the solution according to that,
suppose u created the class to search the name of sdn developers, lets class named as <b>zcl_sdn_search</b>.
now u like to serach name of developers, for that their is a method in class named as <b>search_developer</b>.
and we also have method to display Business card of that Devloper, named as <b>get_dev_data</b>.
so here is the code which u have to write in onInitialization Event Handler.
data: dev_tab TYPE dev_tab.
CALL METHOD zcl_sdn_search=>search_developer
EXPORTING
developer = developer
forum = forum
keyword = keyword
IMPORTING dev_tab = dev_tab
EXCEPTIONS
no_search_parameter = 2
invalid_forum = 4.
if sy-subrc = 4.
navigation->goto_page( 'invalid_forum.htm' ).
elseif sy-subrc <> 0.
navigation->goto_page( 'error.htm' ).
endif.
IF sy-subrc = 0.
CALL METHOD zcl_sdn_search=>get_dev_data
EXPORTING
dev_tab = dev_tab
IMPORTING
card_tab = card_tab
EXCEPTIONS
empty_input_table = 2
invalid_dev = 4.
ENDIF.
so in the same manner u can call any method, and method contains the business logic or u can take any action depending on situation.
so hope i helped u in some manner. if still u have something different in mind, so let me clear.
Regards,
kamaljeet -
Hi All,
I have created an alv report using alv class. I have handled the double click event in that i am calling transaction using row currenlty selected. But after doing subtotalling the list and then i double click a line it is passing wrong data.
Points are awarded,
Regards,
Bharat Mistry
Message was edited by: Bharat MistryHi Bharat,
Read the internal table contents in double click event with e_row-index , then you will get the data of that particular row.
check below code :
local class to handle semantic checks
CLASS lcl_event_receiver DEFINITION DEFERRED.
DATA: g_event_receiver TYPE REF TO lcl_event_receiver.
LOCAL CLASS Definition
*§4.Define and implement event handler to handle event DATA_CHANGED.
CLASS lcl_event_receiver DEFINITION.
public section.
METHODS:
handle_double_click
FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row e_column.
ENDCLASS.
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_double_click.
read table gt_outtab index e_row-index into
Regards
Appana
*Reward Points for helpful answers
Message was edited by: L Appana -
Execute jar file: "could not find the main class" program will terminate
Hey,
I am new to Java. I have started to make a small java program which supposed to help me at my studies to lean the Dominic Memory System. I have used the latest version of Netbeans 5.5.1 to build my program in. I have two problems which I cannot figure out how to solve, please help me.
The first problem is that the java script I have made works when I compile it in Netbeans, but when I create a Jar file it does not work. I receive a pop up message in windows ?could not find the main class program will terminate? when I execute the jar file.
The second problem I have is that I need to compare the strings generated by the "numbers" and "TIP" and if the numbers is not identical the numbers in the ?Center? JPanel should be highlighted as red.
If anyone would like to clean up the code I would be pleased. I have copied quite a lot from anyone because of my one lack of knowledge.
* GoListener.java
* Created on 12. september 2007, 21:48
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
package grandmaster;
import java.awt.event.*;
import javax.swing.*;
import java.util.Vector;
import java.util.StringTokenizer;
import java.awt.Color;
* @author Computer
public class GoListener implements ActionListener {
private JTextField viewer;
private JTextField TIP;
private JTextField freq;
private JTextField max_num;
private Vector numbers;
public GoListener(JTextField j,JTextField k, JTextField m, JTextField f, Vector n) {
freq = f;
max_num = m;
viewer = j;
numbers = n;
TIP = k;
public void actionPerformed(ActionEvent e){
int time = Integer.valueOf(max_num.getText());
int f = Integer.valueOf(freq.getText());
if (e.getActionCommand() == "GO") {
for (int i = 0; i< time;++i) {
int number=0;
number = (int)Math.floor(100*Math.random());
while(number>51){
number = (int)Math.floor(100*Math.random());
if(number<=9){
viewer.setText(" "+"0" + String.valueOf(number) + " ");
} else{
viewer.setText(" " + String.valueOf(number) + " ");
viewer.paintImmediately(viewer.getBounds());
numbers.add(number);
try {
Thread.sleep(f*1000);
} catch (Exception exp) {
viewer.setText(" XX ");
viewer.paintImmediately(viewer.getBounds());
if (e.getActionCommand() == "VIEW") {
try {
//int numb = Integer.valueOf( TIP.getText() ).intValue();
StringTokenizer tokenizer = new StringTokenizer(TIP.getText(), " ");
String[] split = null;
int tokenCount = tokenizer.countTokens();
if (tokenCount > 0) {
split = new String[tokenCount];
for (int current = 0; current < tokenCount; current++) {
split[current] = tokenizer.nextToken();
viewer.setText(" " + String.valueOf(numbers) + " ");
// k=numbers(1);
/*while(c<i){
String.valueOf(k).equals(split[1]);
c++;
TIP.setText(" " + split[2] + " ");
} catch (Exception exp) {
try {
//string testit = numb.toString();
//String str = "" + numb;
//viewer.setText(str);
//viewer.setText(numbers.toString());
numbers.clear();
} catch (Exception exp) {
* Main.java
* Created on 12. september 2007, 21:07
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
package grandmaster;
import java.util.Vector;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.JButton;
import java.awt.*;
import grandmaster.GoListener;
* @author Computer
public class Main extends JFrame {
private JTextField viewer;
public JTextField TIP;
// private TextInputPanel TIP;
private Vector numbers;
/** Creates a new instance of Main */
public Main() {
numbers = new Vector();
JPanel p = new JPanel(new GridLayout(0,4));
JButton go = new JButton();
JButton view_num = new JButton();
go.setText("Go!");
go.setVisible(true);
go.setActionCommand("GO");
view_num.setText("VIEW");
view_num.setVisible(true);
view_num.setActionCommand("VIEW");
JTextField max_num = new JTextField();
max_num.setText("5");
JTextField freq = new JTextField();
freq.setText("1");
viewer = new JTextField();
viewer.setText("XX");
TIP = new JTextField("");
p.add(go);
p.add(max_num);
p.add(freq);
p.add(view_num);
getContentPane().add(p,BorderLayout.NORTH);
getContentPane().add(viewer,BorderLayout.CENTER);
getContentPane().add(TIP,BorderLayout.SOUTH);
setSize(200,200);
GoListener g = new GoListener(viewer,TIP,max_num, freq, numbers);
go.addActionListener(g);
view_num.addActionListener(g);
* @param args the command line arguments
public static void main(String[] args) {
// TODO code application logic here
Main window = new Main();
window.setVisible(true);
}NetBeans questions should be posted to the NB site. It has mailing lists and associated forums.
This tutorial from the NB site addresses running programs outside of NB
http://www.netbeans.org/kb/articles/javase-deploy.html
When you compare objects, use ".equals()" and reserve == for comparing values. -
Hi Experts,
When I am installing Oracle client 32 bit software on Windows 7 32 bit I am getting error as "could not find main class program will exit"
I have tried installing latest Java software 7 also JDK 1.6.0_34 still I am getting the same problem below is my " oraparam.ini " details
[Oracle]
DISTRIBUTION=TRUE
SOURCE=../stage/products.xml
LICENSE_LOCATION=
BOOTSTRAP_COMPS="oracle.swd.oui:11.1.0.6.0,oracle.swd.oui.core:11.1.0.6.0,oracle.jdk:1.5.0.1.1"
JRE_SCRATCH_LOC=jdk/jre
JRE_MEMORY_OPTIONS=" -mx96m"
DEFAULT_HOME_LOCATION=product\11.1.0\client
DEFAULT_HOME_NAME=OraClient11g_home
NO_BROWSE=/net
NLS_ENABLED=TRUE
BOOTSTRAP=TRUE
EXT_JLIB=../stage/ext/jlib
OUI_VERSION=11.1.0.6.0
## JRE_VERSION is only for Windows. This is to copy accessbridge dlls
JRE_VERSION=1.4.2
ACCESS_DIR=../install/access
#SHOW_HOSTNAME=ALWAYS_SHOW shows the hostname panel always
#SHOW_HOSTNAME=NEVER_SHOW does not the hostname panel
#SHOW_HOSTNAME=CONDITION_SHOW shows the hostname panel on condition
SHOW_HOSTNAME=NEVER_SHOW
#THIN_JDBC_FILENAME is optional and defaults to classes12.jar
#The value specified for this should be packaged with OUI, and should
#be relative to <OUI expanded stagedir>/jlib/
THIN_JDBC_FILENAME=classes12.jar
#RUN_OUICA specifies the batch script name that needs to be run
#The script is ouica.bat for win32, and ouica.sh for solaris.
#If the value is not specified, then the OUICA script is not run
RUN_OUICA=ouica.bat
CLUSTERWARE={"oracle.crs","10.1.0.2.0"}
SILENT_VARIABLE_VALIDATION=TRUE
[Generic Prereqs]
MIN_DISPLAY_COLORS=256
[IMAGES]
FILE1=images/billboards.gif
LICENSE_LOCATION=license.txtDuplicates of the other two times you asked this question:
https://forums.oracle.com/thread/2559093
https://forums.oracle.com/thread/2558027
(and this time, your question does not appear to have anything to do with this particular forum space, either)
Duplicate is locked.
Do not EVER multi--post. That is extremely bad forum etiquette. -
Can't find main class - program will end
Dear forum readers,
Recently upgraded from Win2k pro to XP pro .. installation ran to conclusion w/ no fatal errors BUT upon booting new system I now receive an error message "Java Virtual Machine Launcher can't find main class, program will end" .. I am not aware that this error is causing any problems BUT it is annoying and I'd like to be able to fix the problem so I don't have to close the error message at each startup .. please help!
Thanks in advance, LarryTry this
java -XbootClasspath/a -jar <<Prog name>>
I think you are trying in windows XP.
Also you need to modify if there are any other jars to be reference. For eg if a.jar is also required for this try as below
java -XbootClasspath/a:a.jar -jar <<Prog name>> -
Error msg Could not find the main class.Program will exit. in jar execution
Hello,
I have created a jar so that I can used it in the webapp.
but when I click on it it says "Could not find the main class.Program will exit."
I searched a lot in the net and found that it has to do with the manifest file.
I even updated the manifest file using the command "jar umf main.txt filefolderupload.jar" with the class name mention along with the package heirarchy.
(pakage heirarchy in /,\ and .)
I am using JDK 1.5 . and have Updated JRE 1.6.
Also tried with extending the class with JApplet, but in vain.
Kindly help me in the above mention issue.
tia,
SarwaThis post hints at a number of misunderstandings on your part, and raises a couple of important questions.
Note that this 'simple question' has a complicated answer. Given the complexity of it, it might pay to add Dukes to it, ..a lot of Dukes.
The important questions are.
1) Does this file/directory uploader need to provide the end-user with a file dialog in which they can choose a local directory to upload, or will a multi-file chooser do?
2) Does this uploader need to upload to foreign sites, or does it upload back to its own server?
Looking at this table I prepared to describe the [uploader/local file access|http://pscode.org/test/uploader/fileuploader.html] possibilities, if the answers to the questions are 'multi-file chooser will do' and 'home site only', the best option is a sandboxed app. launched using webstart (JNLP) - option 5. If either of those questions go the other way, option 6 (digitally signed with extended permissions) is needed. -
Send me notes of ALV, DAILOG PROGRAMMING
hi friends,
this is shafeeq plz send me the notes of ALV, DAILOG PROGRAMMING WITH SOME interview quetions also
MY MAIL ID [email protected]
accept my thanks in advance
regards
shafeeqHi,
dialog programming.
Refer to the documentation @
<u>http://help.sap.com/saphelp_47x200/helpdata/en/c9/5472fc787f11d194c90000e8353423/frameset.htm</u>
<u>http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
http://help.sap.com/saphelp_webas630/helpdata/en/9f/db9cdc35c111d1829f0000e829fbfe/content.htm</u>
<b>ALV</b>
check these links,
About ALV:
http://www.geocities.com/mpioud/Abap_programs.html
ALV Group Heading
http://www.sap-img.com/fu037.htm
and few more,
ALV
1. Please give me general info on ALV.
http://www.sapfans.com/forums/viewtopic.php?t=58286
http://www.sapfans.com/forums/viewtopic.php?t=76490
http://www.sapfans.com/forums/viewtopic.php?t=20591
http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
2. How do I program double click in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=11601
http://www.sapfans.com/forums/viewtopic.php?t=23010
3. How do I add subtotals (I have problem to add them)...
http://www.sapfans.com/forums/viewtopic.php?t=20386
http://www.sapfans.com/forums/viewtopic.php?t=85191
http://www.sapfans.com/forums/viewtopic.php?t=88401
http://www.sapfans.com/forums/viewtopic.php?t=17335
4. How to add list heading like top-of-page in ABAP lists?
http://www.sapfans.com/forums/viewtopic.php?t=58775
http://www.sapfans.com/forums/viewtopic.php?t=60550
http://www.sapfans.com/forums/viewtopic.php?t=16629
5. How to print page number / total number of pages X/XX in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
http://www.sapfans.com/forums/viewtopic.php?t=64320
http://www.sapfans.com/forums/viewtopic.php?t=44477
7. How can I set the cell color in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=52107
8. How do I print a logo/graphics in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=81149
http://www.sapfans.com/forums/viewtopic.php?t=35498
http://www.sapfans.com/forums/viewtopic.php?t=5013
9. How do I create and use input-enabled fields in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=84933
http://www.sapfans.com/forums/viewtopic.php?t=69878
10. How can I use ALV for reports that are going to be run in background?
http://www.sapfans.com/forums/viewtopic.php?t=83243
http://www.sapfans.com/forums/viewtopic.php?t=19224
11. How can I display an icon in ALV? (Common requirement is traffic light icon).
http://www.sapfans.com/forums/viewtopic.php?t=79424
http://www.sapfans.com/forums/viewtopic.php?t=24512
12. How can I display a checkbox in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=88376
http://www.sapfans.com/forums/viewtopic.php?t=40968
http://www.sapfans.com/forums/viewtopic.php?t=6919
<b>Interview questions</b>.
refer this one...
/message/2042837#2042837 [original link is broken]
Please check these links.
http://www.sap-img.com/abap/abap-interview-question.htm
http://www.sap-img.com/abap/answers-to-some-abap-interview-questions.htm
http://sap.ittoolbox.com/documents/document.asp?i=3240
http://www.techinterviews.com/?p=198
Regards
Anver
if hlped pls mark points -
Varient display in ALV Classes
Hi
I am using ALV Classes. I need to use varient for selection screen parameter. In this case, I need to pass group of values for this parameter. how to implement this requirement. Cud u pls suggest this.
Regards,
Naseerwell when u enter the input once,
go for save button,there they will ask to process in background,or like front,choose any one relently,the input will be saved as varient
and will apper every time u come on selection screen
rewards if useful. -
Actually i have one doubt in message class
Actually i have one doubt in message class. I want create message for following logic.
If the records already exits in database table ,
whatever input i will given in input fields like entry type and material no ,it will need in message.
i want rise the error message in my code like "Record entry type B Material no 029585888 already exits in database table".
I done the coding like.........
in SE80.
IF sy-subrc = 0.
MESSAGE e039 with zdbt-enttyp
zdbt-matnr.
ENDIF.
in SE91.
Record entry type &1 Location &2 already exits in database table.
is it correct? it s not working properly..
could you advice me.......Hello Raju
The only possible problem I see is that in your report you send a message of the wrong message class. Assuming that your message class is ZMSG then assure that your report begins with:
REPORT zreport MESSAGE-ID zmsg.
IF sy-subrc = 0.
MESSAGE e039 with zdbt-enttyp
zdbt-matnr.
ENDIF.
Regards
Uwe -
Error:-could not find the main class programe will exit(Java virtual mach)
Hi,
i changed the mainfest file for an executive jar file(judge.jar) using the command on dos :-"jar cvfm judge.jar c:\judge\MAINFEST.MF -C judge/ ." , but when i run this jar file again after making changes in mainfest file it is not working. an error encounter like "could not find the main class programe will exit how to solve"(Java virtual machine launcher).please suggest me how to solve this error.
Thanks
Ashwani GuptaHi,
mainfest file has a entry like "main -class: judge.repository.corpus"
please tell me the solution of this error i am doing internship in national university of singapore......and my project is related to data mining.I am using judge.jar when i extract this jar files i saw there was no main-class in manifest file so i change it and make it again jar file using dos command.please suggest me how i can reomove this error.
Thanks in advance.
Ashwani -
Hi,
I have doubt in abstract classes,please clarify my doubt.....my doubt is
I have one abstract class,in that i have three methods...
Now I have created one subclass for that abstract class....
I defined all those methods that are there in abstract class in the sub class......and I wrote some other methods in that sub class....
Now my question is ----->can I make the methods that are declared in abstract class invisible to the people who are using the sub class???
Please tell me the answer...
Thanks in advance,
sirisha.ya I got it....
Please see the code and tell me wether it is correct or not...
abstract class One
int i=10;
private void display()
System.out.println("One:display");
public void show()
System.out.println("One:show");
public abstract int intadd(int j);
class Two extends One
int i=100;
public void display()
super.display();
System.out.println("TestThr:display");
public void show()
//super.show();
System.out.println("TestThr:show");
public int intadd(int j)
if (j==1)
return i;
else
return super.i;
public class TestThr
public static void main(String args[])
Two t=new Two();
t.display();
t.show();
System.out.println(t.intadd(1));
} -
Jar file error: could not find main class. program will exit
I have created a jar file using following command
jar cfm MyProj.jar Manifest.txt richa\*.class
and I have included main class header in the Manifest.txt. The executable jar file is created but when I double click on it, it prompts an error Could not find the main class. program will exit.
Please help. Its urgent..
Thanks in advanceThis simply state that jvm was unable to fine Main Class file.
I hope you have configured manifest file including your main file information and class path used by the project with proper package hierarchy,
as described in article
[https://java.sun.com/docs/books/tutorial/deployment/jar|https://java.sun.com/docs/books/tutorial/deployment/jar]
Edited by: Deepesh on Jul 13, 2008 4:58 AM
Maybe you are looking for
-
How should I come out of this? Suddenly I am seeing this message in the alert log after everyone complained that they couldn't do anything with the database? I tried this SQL> ALTER SYSTEM UNQUIESCE 2 ; ALTER SYSTEM UNQUIESCE ERROR at line 1: ORA-
-
Unable to install a software driver for Canon film scanner on mac OSX 10.6
I am unable to install a software driver for a Canon film scanner FS4000US. I have downloaded it from Canon then open the package click the install and it asks for a location namely the Applications folder. Then it says it has been installed re -star
-
Interview Questions related to Warehouse management
Hi all Can u please help me regarding Interview Questions related to Warehouse management Thanks and Regds Daniel
-
Exception with (Unknown Source), possible to specify source file?
Hi, I'm getting exceptions of the kind java.lang.NullPointerException at blockworld.EnvView.paintComponent(Unknown Source)The class EnvView is loaded from a .jar at runtime (it's a plugin-like construction). Is it possible to tell the VM wher
-
T40 2373-8CU battery light stays on when unit unplugged and shut down
i have a T40 that the battery light stays on with the unit shut down and unplugged. It would appear that the battery is always discharging with this issue.