Opening/Closing JFrames
Hi all,
I am a bit confused as to what is the best (most effecient) way to call a window from another window (or a JFrame from another JFrame).
Let us assume that you have a JFrame with many buttons. One of these buttons opens another JFrame. However, the calling frame should hang until the second frame is closed or exited. What is the best way to implement this thing? Also, what is the best way to close this second window and releasing all memory associated with it.
Currently, when the second Jframe is to be opened, i am doing the following:
JFrame frame2 = new JFrame (this);
this.setEnabled (false);I am constructing a new JFrame and passing the first frame as an argument. and then i am disabling the first window.
Now in the second window, the windowClosing method looks like this:
this.setVisible (false);
frame1.setEnabled (true); //frame1 is the first frame that was passed as an argument
this.dispose ();Please inform me if there exists a better way of doing this. Mainly, I want to know how can I make the first frame wait on the second frame (same when two threads are joined). How can I do this with frames?
Thanks in advance.
Use a modal JDialog.
Similar Messages
-
Call method after closing JFrame
Hi everyone,
I'm opening a JFrame in another JFrame.
Here is the code and beneath is the question.
import javax.swing.*;
import javax.swing.text.*;
import java.awt.event.*;
import java.awt.*;
import java.util.*;
public class ContactsInterface extends JFrame implements ActionListener
JList contactList;
private DefaultListModel listModel;
JPanel buttonPanel;
JPanel detailsPanel;
JButton addButton, updateButton, deleteButton, refreshButton;
JLabel companyLabel;
JTextField companyField;
public ContactsInterface()
super("ContactList");
listModel = new DefaultListModel();
contactList = new JList(listModel);
buttonPanel = new JPanel();
detailsPanel = new JPanel();
addButton = new JButton("Add Record");
addButton.addActionListener(this);
updateButton = new JButton("Update Record");
updateButton.addActionListener(this);
deleteButton = new JButton("Delete Record");
deleteButton.addActionListener(this);
refreshButton = new JButton("Refresh");
refreshButton.addActionListener(this);
companyLabel = new JLabel(" Company:");
companyField = new JTextField(10);
companyField.setEditable(false);
buttonPanel.setLayout(new FlowLayout());
detailsPanel.setLayout(new GridLayout(6,2,10,10));
buttonPanel.add(addButton);
buttonPanel.add(updateButton);
buttonPanel.add(deleteButton);
buttonPanel.add(refreshButton);
detailsPanel.add(companyLabel);
detailsPanel.add(companyField);
setLayout(new BorderLayout());
JScrollPane contactJScroll = new JScrollPane();
contactJScroll.setPreferredSize(new Dimension(100,80));
contactJScroll.getViewport().setView(contactList);
add(contactJScroll, BorderLayout.WEST);
add(buttonPanel, BorderLayout.SOUTH);
add(detailsPanel, BorderLayout.CENTER);
public void actionPerformed(ActionEvent e)
String args = e.getActionCommand();
if(args.equals("Add Record"))
openAddRecord();
public static void main(String args[]) //main method of the ContactsInterface
ContactsInterface CInterface = new ContactsInterface();
CInterface.setJMenuBar(CInterface.createMenuBar());
CInterface.setDefaultCloseOperation(EXIT_ON_CLOSE);
CInterface.setSize(500,300);
CInterface.setVisible(true);
CInterface.setResizable(false);
public void openAddRecord() // The method being called when clicking Add record which in turn opens another JFrame on top of the ContactsInterface JFrame
record = new AddRecord();
record.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
record.setVisible(true);
record.setResizable(false);
record.setSize(400,300);
public void refreshList(String company) //The method that needs to be called when disposing of the openAddRecord JFrame
listModel.addElement(company);
int index;
index = contactList.getLastVisibleIndex();
index++;
contactList.setSelectedIndex(index);
contactList.ensureIndexIsVisible(index);
}The "openAddRecord Frame" opens fine, in the "openAddRecord JFrame" I add a company name.
How can I when I click on the "Save" button in the "openAddRecord JFrame" and then dispose(); of the "openAddRecord JFrame" let it call a method in the "ContactsInterface JFrame" which was the parent of "openAddRecord JFrame" / were the "openAddRecord JFrame" was opened in, to refresh the JList by calling the "refreshList" method.Don't use multiple JFrames.
A typical application will only ever have a single JFrame. If you need a second window you would use a JDialog. If you want to stop execution until the dialog is closed then you would use a "modal" JDialog. -
GL account opening/closing balances by day
Hi All.
I wish to list day by day opening and closing balances of G/L account by restricting the result to a time interval.
Anyone know how to write the query for G/L account opening & closing balances by day?
I found this in the forum and modify it to below:
declare @fr char(10)
declare @to char(10)
set @fr=convert (char(10),[%0],20)
set @to=convert (char(10),[%1],20)
declare @PrCl dec(19,6)
declare @de dec(19,6)
declare @cr dec(19,6)
declare @acc char(20)
declare @Pracc char(20)
Create table #W
(M char(10), Acc char(20), Me char(100), Tid char(10), Br char(10), TT char(30), Op dec(19,6),De dec(19,6),Cr dec(19,6),Cl dec(19,6) )
Insert into #W (M,Acc,Me,Tid,Br,TT,Op,De,Cr,Cl)
SELECT convert (char(10),T1.[RefDate],20)Mo, T1.[Account],T0.Memo, T0.TransId, T0.BaseRef, CASE
WHEN T0.TransType = 13 THEN 'AR Inv'
WHEN T0.TransType = 14 THEN 'AR CN'
WHEN T0.TransType = 18 THEN 'AP Inv'
WHEN T0.TransType = 19 THEN 'AP CN'
WHEN T0.TransType = 24 THEN 'Incoming Payment'
WHEN T0.TransType = 30 THEN 'JE'
WHEN T0.TransType = 46 THEN 'Outgoing Payment'
ELSE 'Other'
END AS 'Trans Type',
0,T1.[Debit] De , T1.[Credit] Cr,0
FROM OJDT T0 INNER JOIN JDT1 T1 ON T0.TransId = T1.TransId
Group by T1.[Account],convert (char(10),T1.[RefDate],20),T0.Memo, T0.TransId, T0.BaseRef, T0.TransType, T1.Debit, T1.Credit
Order By T1.[Account],convert (char(10),T1.[RefDate],20)
Declare cu cursor for
Select acc,de,cr from #W
for update
set @PrAcc=''
Open cu
Fetch next from cu into @acc,@de,@cr
While @@FETCH_STATUS = 0
Begin
If @acc!=@PrAcc set @PrCl=0
Update #W
set op=@PrCl,
cl=@PrCl-@Cr+@de
where current of cu
set @PrCl=@PrCl-@Cr+@de
set @PrAcc=@acc
Fetch next from cu into @acc,@de,@cr
End
deallocate cu
Select * from #w
Where M between @fr and @to
Drop table #W
but some of the rows are missing from the result. e.g. row with the same value of debit/credit ( same TransId and BaseRef) will come out once only in the result.
Please guide me on the above issue.
Thanks & Best Regards,
LengHi,
You have to make use of many tables for this purpose.
1. You have to claculate the previuos period and finscal year for the given date..
2. You have to calculate the G/L balances for this period for the given G/L account from table GLT0.(You can use some of the standard function modules for the same)
3. You have get the line items from the various tables like BSIS,BSAS,BSIK, BASK, BSID and BSAD for the dates from the begining of the month to the given date-1. sum upthis amount with the amount retrieved from step 2 .This will be the opening balance for the given date.
4.retrieve the data from he same tables like step 3 for the given date. This will the transactions of the given date.
5. sum up the amounts from step 4 with step 3. this will be the closing balance for that date.
let me know id you want any further info..
Reward the points if i answered your question.. -
Opening & Closing balances of Vendor
Hi Experts,
I am doing a report where in i need to get the opening & closing balances for Vendor(s). I am using BSIK & BSAK tables. Are there any more tables involved and how do i carry out the calculations?
Please help.
Thanks
Danyhi Dn,
That would suffice for your requirement .
Regards,
Santosh -
Opening & closing balances for Vendor
Hi Experts,
I am doing a report where in i need to get the opening & closing balances for Vendor(s). I am using BSIK & BSAK tables. Are there any more tables involved and how do i carry out the calculations?
Please help.
Thanks
DanyHi,
There are various t. code to check line items for vendor like: S_ALR_87012103 but Any table is not helping to check opening/closeing balance for vendor.
Table BSIK and BSAK are having are records for open items and close items for vendor and system calculate the balance by using these tables.
Regards,
Vinod -
Storage location wise Opening/Closing Stock on posting date (mb5b)
Hi,
Report mb5b gives opening stock and closing stock as on date. In the selection screen, if we do not enter specific storage location then the opening/closing stock is displayed as sum of all storage location stocks for a given material.
Where as if we enter storage location, it gives storage location specific output. (with Storage loc/batch stock radio button)
My requirement is - without entering storage location in the initial screen, the system should display storage location specific opening/closing stock.
To get this, presently I need to execute mb5b transaction individually for every storage location.
Warm regards,
MSHi Madhavi
This report you can have in T code MC.6 and another t code for opening and closing stock in t code MC.9
Regards
Vivek
-- Reward if helpful
Edited by: Supergene on Feb 28, 2008 3:17 PM -
Query regarding Opened/Closed GL periods
Hello Gurus,
ive got an issue, when using 0FIGL_C01 Cube.
The query ive created balances on cumulative balance (as key figure) and GL account names (as hierarchy).
Now i want to show the data of cumulative balance regarding closed periods.
I.e. if we have current April month the balance should be 0, but all other in the past January, February, March should be displayed.
How it is possible to do this?
Ive tryed to create a calculated key figure, whith code something like:
IF debit and credit == 0 then Cummulative balance=0 else Cumulative balance.
It works fine but it shows also the postings of current period, which isnt realy closed.
Tried to search the indicators of FI open/closed periods, but the only thing i found is S_ALR_87003642 - Open and Close Posting Periods transaction showing Company code, GL account ranges and from to period data.
What could be the sollution for this? Should i create new DS for the mensioned TC and then to create a multicube or perhaps is a better and faster way in doing it?
Thanks a lot in advice
Laurynas PrikockisHi Shrikant,
>
Shrikant Varma wrote:
> Yes, I could consider using belnr selection to reduce the size of the selection. This will again be a selection more
> based on knowledge of application(of course with fine tuning of packet size).
> But then this approach will not be as efficient and as easy as letting database take control of the iteration of this
> huge dataset - as is intended by the use of cursors with the help of packet size.
>
I'm not sure what you mean here: "let the database contorl the iteration of this huge dataset - with cursors".
Generally speaking you have 2 options when it comes to parallel processing:
Parallelize processes in the ABAP stack. These processes access different, non-overlaping, parts of your restult set
in parallel. Using the BELNR could be an approach to build different, non-overlapping paackages.
Database side parallelization. This is possible for every action that uses multiblock I/O (full table scans and index fast full scans) and for partitioned segments. For non-partitioned segments and single block I/O database side parallelization is not possible.
So, generally speaking, you have 3 options:
1.) parallelize in ABAP and build idependent packages
2.) force the DB to do multiblock I/O (full table scan, index fast full scan) in parallel
3.) partition your table and indexes.
I think (it's just my opinion) for an ERP (not BW / BI) system
- option 3 is not a good option for OLTP systems (several reasons). I see it very, very, very rarely or close to never in OLTP systems
- option 2 may read (much) more data then you would need to read, although a very efficient I/O method would be used (multibock I/O)
- option 1 requires programming in ABAP but will read exactly the data you need to read and can be controlled very well in the ABAP stack (parallel single block I/O will be used)
In alamost all cases (that are similar to your case) i have see option 1 was used.
Kind regards,
Hermann -
Authorization for opening & Closing posting periods - OB52
Hi,
Is there any way to set authorization for opening & closing of posting periods in OB52?
My scenario:
I have 2 company codes - A & B assigned to 2 different posting period variant - say PPA & PPB.
The user belonging to CoCd A should not be able to open/close posting period of CoCd B and vice versa.
Is this possible through any authorization settings?
Request your help on this.
Regards,
SrideviHi Sridevi
Please go through the following:
You can assign authorization groups for permitted posting periods. This means that, for example, some posting periods can only be opened for particular users within monthly or annual closing. You can only assign the authorization group at document header level and it only affects period 1. The authorization object is called F_BKPF_BUP (Accounting document: Authorizations for posting periods). Read the corresponding chapter on "User maintenance" in the "Assigning authorizations" topic.
"User maintenance"
Due to the modular authorization concept of the system, you can define authorization profiles which are tailored to the workplace of your employees. You can, for example, assign authorization to a workplace in the Accounts Receivable, Accounts Payable or General Ledger Accounting areas.
By assigning authorizations you define which business-related objects your employees are allowed to process and which editing functions are allowed.
In the following activities for authorization management, you must carry out the following for employees who are to work with the system:
Assign authorizations
The authorizations are assigned by specifying permitted values for the pre-defined objects.
Define profiles
In the SAP system, authorizations are grouped together in workplace profiles. Therefore one or more profiles must be allocated to the individual employee in the master record.
I hope this helps.
Regards
Kavitha -
Mismatchin in opening & closing balance ofj2i9 & j2i6 register
Hi,
We have done utilization on 1st of Month but the posting date was entered as 31st of previous month.
Now the system showing mismatch in J2I9 & J2I6 between opening & closing balances for the previous period. The entry is missing in J2I9 but the same it is showing in J2I6 as Dr Entry. Why the system is not showing the Dr Entry in J2I9.And moreover the opening & closing balances are matching for the current and last month, but there is mismatch in the month of Dec in the same month utilization was carried out on 1st of Jan but posting date was entered as 31st Dec. What could be reason?
RgsHI !
Now that we have not maintained the values in J_2iRG1bal, so how do I correct the problem, what should I do so that the opening balance & closing balance values appear in the RG1 report.
Kindly suggest.
Regards,
DGN -
GL_DAILY_BALANCES table for daily opening/closing balance
Hi All,
I need to know something about the GL_Daily_Balances table. In eTRM, it says that the table gives the balances for a particular day. My requirement is to show the opening and closing balances on daily basis. But, I found that all the END_OF_DAY columns (END_OF_DAY1...END_OF_DAY35) are NULL.
Can anyone tell me why these columns are NULL ? Under what conditions, they are null ? How can I get the opening /closing balance then?
Thanks!
YoginiHi Yogini,
This table is populated when balance processing is enabled in the definition of each set of books, do you have it?
You can read about in the metalink note # 1072012.6
Bye -
Stock Statement - Opening & Closing Values
Hi Guys,
I am using the below query for opening & Closing Stock Report.
select a.ItemCode,a.Des, a.WareHouse , (SELECT (sum(t1.inqty - t1.outqty))
FROM OINM t1
WHERE (T1.DocDate < '[%1]') and (t1.itemcode = a.itemcode) and
(t1.warehouse = a.whs) ) as 'OB',
a.Price,a.inqty as 'Goods Receipt',a.outqty as 'Goods Issue',
(SELECT (sum(t1.inqty) - sum(t1.outqty))
FROM OINM t1
WHERE (T1.DocDate <= '[%2]') and
(t1.itemcode = a.itemcode) and (t1.warehouse = a.whs)) as 'Closing',
(SELECT (sum (t1.transvalue))
FROM OINM t1
WHERE (T1.DocDate <= '[%2]') and (t1.itemcode = a.itemcode) and
(t1.warehouse = a.whs)) as 'ClosingValue'
from (SELECT max(T0.[ItemCode]) as 'ItemCode',
max(T0.[Dscription]) as 'Des',sum(T0.[InQty]) as 'InQty', sum(T0.[OutQty]) 'OutQty',
t0.warehouse as 'whs' ,
(select w1.whsname from owhs w1 where w1.whscode = t0.warehouse) as 'Warehouse',
avg(T0.[Price]) as 'Price'
FROM OINM T0
inner join oitm o1 on o1.itemcode = t0.itemcode
inner join oitb o2 on o2.itmsgrpcod = o1.itmsgrpcod
WHERE (T0.[DocDate] >= '[%1]' and T0.[DocDate] <= '[%2]') and
(TransType != '10000071' and Transtype !='67' ) and
(o2.itmsgrpnam >= '[%3]' and o2.itmsgrpnam <= '[%4]' )
group by T0.[ItemCode],t0.warehouse)a
But i need some changes in the Report and below is the selection criteria,
Pls somebody help me in achieveing this.
Report 1:
Item Group: Group B
u2022 Column: Goods Issue
Field to be fetched: Invoice Qty. for the respective FG items
From Ware House No.: 02
Fetching type: Cumulative for given date range
u2022 Column: Goods Receipt
Field to be fetched: Receipt from Production for FG items
Receipt Warehouse: 02
Fetching type: Cumulative for given date range
Report 2:
For Item Groups- Accessories, Consumables & Raw materials:
Column: Goods Issue
Issue from Warehouse No.: 08 ,33
Field to be fetched: Issue for Production (BoM qty-Back-flush & Manual issue by system)
Fetching type: Cumulative for given date range
Column: Goods Receipt
Receiving Warehouse No.: 08 ,33
Field to be fetched: GRPO qty. against respective Purchase Order.
Fetching type: Cumulative for given date range
Report 3:
For Item Group-WIP
Column: Goods Issue
Issue from Warehouse No: 04,09,17,18,20,21,23,28,29,30,31,32,34,38,39,44,45,46
Fields to be fetched: All types of issues ( Issue for prodn. through Prodn.order, GI &
Inventary Transfer)
Fetching type: Cumulative for given period.
Column: Goods Receipt
Receiving Warehouse Nos:04,09,17,18,20,21,23,28,29,30,31,32,34,38,39,44,45,46
Fields to be fetched: All types of Receipt (Receipt from Prodn. through Prodn.order, GR )
Fetching Type: Cumulative for given period.
Regards,
VamsiDear Srini,
Yes of-course Tally shows OB,and Closing balance at a particular time, SAP B1 Shows them too, but in a different manner.
1. Suppose , you have given OB to SAP on 01/04/10.(which is actually the closing balance of Tally as on 31/03/10).
Under trial balance report OB Column is there.
If you are trying to populate Tally's OB of 01/04/09, You Can't.
2. Getting the OB at a particular time in SAP, depends how you are maintaining your Posting Periods.
For Closing balance in SAP, The last column -'Balance' is actually the Closing balance as on the date for you are running Trial Balance Report.
Hope this will help you.
Best Regards
Ashutosh T -
Opening & Closing balance of RG23A part II are miss matching for SECS only
Hi Gurus,
Opening & Closing balance for the month of May & April are mismatching for SECS only. where as BED & all other values are getting matched with April closeing & May opening.
I have checked from Jan till Aprill everything is ok but after this in May i have problem.
My closeing value in April for SECS is 40K where in May opening it is showing 5K. I use J2i6 to download the register.
Plz can any one tell me how should i track this inconsistency.Its possible that some transactions are posted after you extract the report. Extract the report again (J2I5) and print them.
Have you configured different GL accounts for posting BED, ECS & HCS. From your description, it seems same GL is assigned for all three components.
Ravi. -
Opening & Closing Stock in transit
Hi All,
I Developed an abap report for Yield Statement with opening & closing Stock Quantities.
How to Find opening & Closing For transit Stock for 641 movement.I mean how to display the current transit stocks date wise at plant level without SLOC.
I Knew that current transit stock would be in Marc Table & previous closings in March Tables.
I'm looking for the date logic with respect to displaying opening & closing dates of transit stock.Be it Date Wise Or Month Wise.
Any help would be greatly appreciated.
Thanks & Regards,
Ravi SHi Ravi,
Please find the Link below hope they are very useful to you
[Stock|Re: closing stock of a particular date]
[Stock|Tables/FM for opening/closing stock for material on given posting date]
Thanks
kalyan -
Hi Guys,
In some cases, we open the SAP system to do some configuration for certain tables.
We have to request the Basis team to open the SAP system..What exactly do we mean by this opening of the system?
Are we allowing the customization of certain tables which is otherwise not possible in the Quality system?
And we again need to close the system..What is the purpose of this opening/closing....
thanks
srik.Hi
This is related to systems & Client set up required whenever you want to do a major changes and the following will help you more on this.
http://help.sap.com/saphelp_46c/helpdata/en/2e/d9530294f911d283d40000e829fbbd/content.htm
Regards
Shan -
Tables/FM for opening/closing stock for material on given posting date
Hi All,
I had requirement of find the opening/closing stock for material on given posting date. The values we can find out using TCode - MB5B.
But I cannt use MB5B to extract data because I need to find detials for thousands of material.
Can you please adivce if their is any FM or tables through which i can find this detial on any given date apart from current date.
Thanks & Regards,Hi,
[https://forums.sdn.sap.com/click.jspa?searchID=19631709&messageID=6593903]
[https://forums.sdn.sap.com/click.jspa?searchID=19631709&messageID=6630975]
Maybe you are looking for
-
Sometimes when I attempt to access products on Amazon, Ebay, etc., I get a blank square with a picture of a camera obviously indicating the website cannot show the picture. However, when I then close Firefox and enter these websites using Internet Ex
-
Need to Sync user Files between XP laptops to Mac X Server - Solutions?
We have 4 users on Windows XP laptops and they want to sync their files back to a Mac OS X server and to their individual home accounts. Is there a program out there that can do this on an automatic basis? Was using Sync Tool from Microsoft but was t
-
I have the iPhone 1.1.2 connected to Outlook 2007 thru iTunes 7.5 , running on Vista (Bad, I know). I already downloaded 3 bug fixes from Microsoft that made iTunes finally sync properly on my Sony VAIO... There is a setting on iTunes that says: DO N
-
" IF 1 = 2 ", what make this condition sense here?
Hello Gurus, I have a excerpt from function module used for sap bw extraction from generic datasource. CASE i_dsource. WHEN 'ZMOZ_DELTA_OPEW'. WHEN OTHERS. IF 1 = 2. MESSAGE e009(r3). ENDIF. for " IF 1 = 2. MESSAGE e009(r3). ENDIF", conditi
-
Intstall X11 from Macbook Pro Install disk 1
Does anyone have experience with installing X11? I cannot find the installer for the X11.app. The X11SDK installer is there though MBP 15.4" 1.83 W8613 Mac OS X (10.4.7) iMac DV G3 450, Color Classic, II+, IIe, IIc, IIgs, III+, Various PC's