How to display information taken from text area in netbeans (for a GUI)? - user-interface

I have taken information from a text area (on a JFrame) and saved it as a variable, but now I would like to display the string thats stored in that variable in a different JFrame (which already have created). how do i go about doing this?
Example:
one frame says: enter your name (store this value in a variable)
click proceed
closes first frame
second frame is open now and I want to display the name of the player (variable) in the top corner of the JFrame.
Any ideas on what to use from the swing palette?

Save the value in a static variable so that you can use it anywhere.

Related

Oracle Reports-How To Add Field Object To Repeating Frame

I want to add field object to an existing repeating frame.But when I drag the field, new frame is generated.
See Image below.
I want to do is put the field F_PO_NUMBER under R_INVOICE frame.
Doble-click on the Paper Layout node.
Touch R_INVOICE repeating frame on the Object Navigator.
Change Fill colour of R_INVOICE by selecting a different than that already has ( colour palette pointers are located on the left side of the Paper Layout ).
Let's choose gray as fill colour, and then there will appear a great gray box on the Paper Layout.
Just drag F_PO_NUMBER to the inside of that gray box. If some frames or objects slides as you drag F_PO_NUMBER, apply immediately an undo by pressing Ctrl+Z, and play with Flex On/Off or Confine On/Off buttons up to your object is able to be removed into that gray box.
I'd suggest you to
create a backup copy of that RDF file - you might need to restore the report if something goes wrong
go to paper layout editor
turn flex OFF (so that frames wouldn't stretch)
select any field in the R_INVOICE frame (for example, F_INVOICE_NUMBER)
copy/paste it (Ctrl+C / Ctrl+V)
a new item (named F_INVOICE_NUMBER1) will be created slightly right & below from the original item)
move it to a new position
if necessary, switch flex ON (and, possibly, confine ON/OFF), but be very careful because you might spoil current layout, and - if you do that - it might be difficult to revert changes. Undo works only 1 level back
change its name & source so that they are appropriate (i.e. F_PO_NUMBER)
save & run the report. Hopefully, it'll be OK.
P.S. As you already have the R_1 frame (which is useless), I'd suggest you to remove (in paper layout editor) it, as well as current F_PO_NUMBER field (visible on your screenshot).

Oracle reports builder, printing on last page

I have margin and inside it is a frame that contains a few lines for signatures, but I want it to only be visible on the last page.
So I set it to print on last page, horizontal to variable; but I thought I'd need to add a format trigger on the frame inside the margin. What should I write in pl/sql to achieve this?
If you want a frame to only print on the last page, don't put it in the margin. Instead, put it below all other frames and (as you already have) set it to print only on the last page.
Whatever you put in Margin is always displayed on all pages. Simply move your signature frame to the main layout, below your main group frame. And set it to display on last page only. I assume your signature query is separate query that may or may not be related to other queries... You may keep it inside the main group frame making signature frame variable, for example. It all depends on your design and requirements.
I get it now, there is button in toolbar edit margin, and u can edit everything inside margin. so i put frame inside it and in properties change last page and it worked as i wanted to work. THanks on your replies.

Qtruby ListWidgetItem has blank icon after adding data

I am working on a GUI using qtruby. I have a ListWidget that I am filling with ListWidgetItems. So far these have just contained the text that I wanted to display and everything worked fine. I wanted these items to also hold some hidden data to use when they are clicked on. I used ListWidgetItem.setData() to set the data and I can get the data from it when it is clicked just fine. However once I add the data the text being displayed is now shifted over to the right about 4 spaces. When I click on it a little dotted box appears around the text but not the space that was added. It looks like it is a space for an icon but I have not set any icon and I don't want one. How do I get rid of this extra space so that items containing data are lined up with everything?
The code is very straight forward:
item = Qt::ListWidgetItem.new( #grain_strings[index] )
item.setFont( #font )
# TODO this is causing the text to be indented, removing it removes the indent
item.setData( 1, Qt::Variant.from_value( grain.type ) )
#item_list.insertItem( #end_of_grains+1, item )
The first argument to setData is the role number and for some reason you chose to set it to 1. The documentation says: "The data to be rendered as a decoration in the form of an icon. (QColor, QIcon or QPixmap)". So you are telling Qt to display an icon but you are not giving it a valid icon object.
Try setting the role to Qt::UserRole, which is "The first role that can be used for application-specific purposes." I am not sure how to access that constant from Ruby. If it is not provided by the qtruby gem, you could use 0x100 I suppose.

How can I programmatically detect if some text is visible or has overflowed in an InDesign document using ExtendScript?

I am building an InDesign panel with ExtendScript which finds text and shows it to the user. To do this, I use the showText() method of the Character object. The problem is that sometimes the text I'm looking for doesn't appear because, even though the method does show the right page at the right place, the text has overflown and is not visible.
Is there a way to check if the text is visible or not? Ideally, I would like to be able to fall back on the story editor if the text cannot be seen as-is...
To check the situation for an individual character, see the parentTextFrames property, it returns an array with 0 or 1 frames. In rare cases of insertion points whose left side is in one frame while the right side is in the following, you get two frames.
app.selection[0].characters.item(0).parentTextFrames.length
You can also compare the index of your character against the last index in the last text container of the story, e.g.
app.selection[0].parentStory.textContainers.pop().characters.lastItem().index
Of course you should first see whether there is overflow at all ...
app.selection[0].parentStory.overflows
You may call the baseline property for the text in a try/catch statement. If text is visible, baseline will return a value, otherwise it will raise an error.
Loic

In matlab, how do you save a figure as an image in the same way as using "Save As..." in the figure window?

When saving a figure, what function does Matlab use? For example, when a user selects File > Save As... and then selects .png or another image format, what is going on behind the scenes?
I am asking because I am trying to automate saving, but when I use saveas or print, the resulting image is really pixelated. However, the image looks really good when I save the figure using the method described above.
What method should I use to save my figure from the command line? The actual method that the figure window uses would work, but if you guys have better solutions, I'd appricate it!
The callback for the "Save As..." menu item invokes the function FILEMENUFCN with the first input argument being the handle of the figure the menu is in and the second input argument being the string 'FileSaveAs'. If you have the figure handle stored in the variable hFigure, then the following command should be equivalent to clicking the "Save As..." menu item in that figure window:
>> filemenufcn(hFigure,'FileSaveAs');
A few notes...
The function FILEMENUFCN is only partially documented. You can do help filemenufcn in the command window, but there is no entry for it in the online documentation. In MATLAB 2009a, the function can be found in the following folder:
C:\Program Files\MATLAB\R2009a\toolbox\matlab\uitools\filemenufcn.m
Looking through the function code, it appears that it ultimately calls either the function SAVEAS for .fig files or the function HGEXPORT (with additional input arguments) for other file types.
I was able to hunt down the callback for the "Save As..." menu item by searching through the children of the figure window and its menus. You can do this yourself by setting the root property 'ShowHiddenHandles' to 'on' and then traversing through the 'Children' properties of the figure window and its menus using the GET command. An alternative is to use the FINDALL command, assuming you know some properties of the objects you are looking for. For example, this will find the handle to the "File" menu for the current figure window:
>> hFileMenu = findall(gcf,'Label','&File');
And this will find the handle to the "Save As..." menu item and display its callback:
>> hSaveAs = findall(hFileMenu,'Label','Save &As...');
>> get(hSaveAs,'Callback')
ans =
filemenufcn(gcbf,'FileSaveAs')
I don't know about you, but for me the saved image looks nice.
Code example:
... create some figure ...
saveas(gcf, 'some_figure.png');
To set a user specified resolution use:
print(gcf,'some_figure','-dpng','-rSOMENUMBER')
where SOMENUMBERis a parameter used for the resolution.
The final resolution is (SOMENUMBER*8) x (SOMENUMBER*6)

Resources