Adding custom buttons to JOptionPane
Hi,
I need to add custom buttons to my showMessageDialogue boxes.
I know that
JOptionPane.showMessageDialog
(null, "message body", "message title", JOptionPane.YES_NO_OPTION,
JOptionPane.INFORMATION_MESSAGE);displays an information box with a 'Yes' and a 'No' button. But how do I include three or more custom buttons on such a box?
For example, I want to display an information message box with buttons: 'Auto', 'Prompt' and 'Never'.
What if I want to mix orthodox buttons, with my custom buttons? For example, putting 'Auto', 'Prompt' and 'Cancel' in one information message box?
Thanks,
Hasanka.
Use the last method for showMessageDialog. The options[] paremeter can take an array of Strings and return to you which button was pressed (by index).
showOptionDialog
public static int showOptionDialog(Component parentComponent,
Object message,
String title,
int optionType,
int messageType,
Icon icon,
Object[] options,
Object initialValue)Brings up a modal dialog with a specified icon, where the initial choice is dermined by the initialValue parameter and the number of choices is determined by the optionType parameter.
If optionType is YES_NO_OPTION, or YES_NO_CANCEL_OPTION and the options parameter is null, then the options are supplied by the Look and Feel.
The messageType parameter is primarily used to supply a default icon from the Look and Feel.
Parameters:
parentComponent - determines the Frame in which the dialog is displayed; if null, or if the parentComponent has no Frame, a default Frame is used
message - the Object to display
title - the title string for the dialog
optionType - an integer designating the options available on the dialog: YES_NO_OPTION, or YES_NO_CANCEL_OPTION
messageType - an integer designating the kind of message this is, primarily used to determine the icon from the pluggable Look and Feel: ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE
icon - the icon to display in the dialog
options - an array of objects indicating the possible choices the user can make; if the objects are components, they are rendered properly; non-String objects are rendered using their toString methods; if this parameter is null, the options are determined by the Look and Feel.
initialValue - the object that represents the default selection for the dialog
Returns:
an integer indicating the option chosen by the user, or CLOSED_OPTION if the user closed the Dialog
Similar Messages
-
Adding custom buttons to the Rich Text Editor in CQ
Hi,
I have added custom buttons to the rich text editor in order to allow our editors to add specific content, such as popovers, custom videos and other data necessary data.
I have successfully modifed the Rich Text editor so, that it includes the custom buttons in the actions panel.
I have also managed to make the buttons work and include the data where necessary, when user highlights the text and clicks on a certain button.
The last bit I am struggling with, is the visual feedback we give to the users when this text has associated action with it.
E.g. when we select this text and make it bold when we click on the word B the button B becomes highlighted in the actions panel, later when we continue typing our text and click again on "bold" the letter B becomes highlighted again.
Is there any button related callback/method I could overwrite to add this functionality and make my button highlighted ?
Thanks,
PuzanovsAfter lot's of thinking found a solution....
Essentially the first step is to extend the CQ.form.rte.plugins.Plugin in your custom button.
Then during the UI initialisation we create our "custom"
var pressButton = new ui.TbElement("press-button", this, true,this.getTooltip("press-button")); // Essential extend of the button
setInterval(function() {
if(window.jQuery) {
window.jQuery(document).ready(function () {
window.jQuery(".x-edit-glossary-insert").css({width:45,"background-image":"none"}); // Ignore the background
window.jQuery(".x-edit-glossary-insert").text("Press Button"); // Set the name
$(document).on({
mouseenter: function(){
window.jQuery(".x-edit-glossary-insert").html("<b>Press Button</b>"); // Set the name bold
mouseleave: function(){
window.jQuery(".x-edit-glossary-insert").html("Press Button"); // Set the name normal
}}, '.press-button');
}, 100);
tbGenerator.addElement("press-button", plg.Plugin.SORT_LISTS, pressButton, 10); // element is inserted
Every time the element is inserted I add the following html
<span class="press-button">Test peter</span>
Now, every time in the editor, the content editor mouse overs the custom button it is higlighted in the RTE)) -
Adding Custom buttons to ECL Viewer
Hello Everyone,
We have a requirement where I need to add a custom button on the Redlining section of the ECL Viewer. Like currenty, SAP provides tools like Drawing a line or Square or Rectangle and also Insert Image kind of functionality when doing Redlining. So, the question is in this section along with SAP buttons, can I add a custom button out there which helps to provide my own functionality like adding custom drawing tools?
Please let me know if thats possible or does it requrie modifying some of the SAP DLL files.
Thanks,
Shashidhar.Dear Shashidhar,
regarding your request I have to inform you that the ECL Viewer is developed by a third-party vendor company and so from SAP point of view there is no chance to enlarge the buttons for redlining in the ECL Viewer.
Best regards,
Christoph -
Adding custom button to Ribbon for custom list definition
I'm trying to add a custom button to the ribbon, specifically for a custom list definition. I have two custom list definitions, one for a document library (Type="11008") and one for a list (Type="10002").
I can use the following CustomAction to successfully add a button to the document library ribbon:
<CustomAction Id="MyCustomAction.DocLib"
RegistrationId="11008"
RegistrationType="List"
Location="CommandUI.Ribbon">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.Library.Share.Controls._children">
<Button
Id="MyCustomAction.DocLib.Button"
Alt="Help"
Sequence="5"
Command="SayHi"
Image32by32Left="-64" Image32by32Top="-320" Image32by32="/_layouts/$Resources:core,Language;/images/formatmap32x32.png"
Image16by16Left="-64" Image16by16Top="-176" Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png"
LabelText="Say Hi!"
TemplateAlias="o1"/>
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler Command="SayHi" CommandAction="javascript:alert('Hi!');"/>
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
If I try to do the same thing for my list, the button does not show up:
<CustomAction Id="MyCustomAction.List"
RegistrationId="10002"
RegistrationType="List"
Location="CommandUI.Ribbon">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.List.Share.Controls._children">
<Button
Id="MyCustomAction.List.Button"
Alt="Help"
Sequence="5"
Command="SayHi"
Image32by32Left="-64" Image32by32Top="-320" Image32by32="/_layouts/$Resources:core,Language;/images/formatmap32x32.png"
Image16by16Left="-64" Image16by16Top="-176" Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png"
LabelText="Say Hi!"
TemplateAlias="o1"/>
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler Command="SayHi" CommandAction="javascript:alert('Hi!');"/>
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
What am I missing that is keeping me from getting this button to show up in my List ribbon?Well, I debated just deleting my question, but I'll leave it up in case someone else runs into this. My custom list definition for my list had <Toolbar Type="Freeform" />. I don't remember why I changed that, but once I changed
that back to <Toolbar Type="Standard"/> my custom buttons started showing up as expected.
The answer
here pointed me in the right direction. -
Can i insert the custom button on JOptionPane
sir i want to insert the custom button instead of default buttons means
i want to insert the icon button of ok and cancel.
plz guide me with line of codes
thanks in advanceplz guide me
-
Adding custom buttons to crystal reports html viewer
Hello,
I'm using crystal reports for eclipse and I have a time chart in my report that is displayed with html viewer. I need a button bar to navigate on this chart e.g. the button which adds values to chart for the next month.
Is it possible to add custom buttons to the button bar of crystal reports viewer ?
Thanks in advance.
Greetings,
NikolasDear Shashidhar,
regarding your request I have to inform you that the ECL Viewer is developed by a third-party vendor company and so from SAP point of view there is no chance to enlarge the buttons for redlining in the ECL Viewer.
Best regards,
Christoph -
Adding custom button in standard toolbar in ALV
Hello All,
I need to add a customized button called "Copy" on ALV. The following code is giving me few standard buttons like "Append" "Delete" "Insert" etc. So, how can I add "Copy" button besides one of these standard buttons.
data: l_value type ref to cl_salv_wd_config_table.
data: lr_table_settings type ref to if_salv_wd_table_settings.
lr_table_settings ?= l_value.
lr_table_settings->set_read_only( abap_false ).
Appreciate help.
Thks & Rgds,
HemalCreate One method
And inside that method write the below code
(Here i am creating delete button you can create any name button you want just replace the name
DATA lV_EDITBTN TYPE REF TO cl_salv_wd_fe_button.
DATA lr_buttonui TYPE REF TO cl_salv_wd_fe_button.
CREATE OBJECT lr_buttonui.
lr_buttonui->set_text( 'Details' ).
lr_buttonui->set_tooltip(
'Shows Detail Screen as per the View selected' ).
Generating Function Object for Button.*
DATA btn_button TYPE REF TO cl_salv_wd_function.
btn_button = lo_value->if_salv_wd_function_settings~create_function(
id = 'DETAILS' ).
btn_button->set_editor( lr_buttonui ).
DATA lr_buttonui1 TYPE REF TO cl_salv_wd_fe_button.
After that create another method and make it as a event ( it means now it become event )
select event ON FUNCTION FROM THE LIST
Inside that event write
CASE LV_FCODE.
WHEN 'DETAILS'.
wd_this->fire_OP_TODEATILS_plg( ).
endcase.
May be it may help -
Adding Custom Buttons to Flash Help Skin
Hi.. Can anyone suggest me how to add custom buttons to
FlashHelp Skin. I know we can do this in WebHelp don't know how to
do that in FlashHelp. Any help is greatly appreciated. Thank
you..In a VI go to Edit >> Run-Time Menu to change the menu seen to the user when the VI is running.
To handle when a selection is made use the Event structure. There are are several shipped examples in the Example Finder.
Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously. -
Adding custom buttons to UITableViewCell - iphone
Hello all.
I have a question for the iphone developers,
I want to add several buttons to a UITableViewCell in a grouped TableView I have set up.
The requirements are this:
1) Place two buttons together in a view.
2) Add up to 4 of these views to a UITableViewCell.
It would look like this
row1: O O O O
row2: O O O O
Where each O is a view containing two buttons on top of each other. These buttons, when clicked, take you to a new View.
Anyway, I hope I can get some help, I'm quite new to developing for the iphone.dsan4444 wrote:
I notice that IBAction methods have a sender parameter. Is this the UIButton object that gets pressed?
Yes. In the example, the sender is whichever button sent the 'upperAction' or 'lowerAction' message. There are two separate action methods because I took your description to mean that "upper" buttons would have a different function from "lower" buttons. But you could certainly connect all the buttons to one action method if desired.
Note the connection between button and action method is made by [addTarget:action:forControlEvents:|http://developer.apple.com/iphone/library/d ocumentation/UIKit/Reference/UIControlClass/Reference/Reference.html#//appleref/doc/uid/TP40006779-RH2-SW4], which UIButton inherits from UIControl. This method makes an event-action connection just as if you had dragged from the button to the controller in IB. Of course doing this in code allows us to choose the target object and the action method dynamically.
it would nice if I could make a subclass of UIButton and then add info fields to that so I can easily access them without matching up tags.
That would be a poor decision. You would be duplicating the information stored in the data source, not a good reason to buy-in to the possible problems of a custom subclass. In fact, redundant data storage is usually poor design regardless of the extra effort. In other words, subclassing to duplicate the data model would be like paying to acquire an illness of some kind.
The way to do what you want is to use the sender's tag as a data source key. I think that was your first idea, which is why I saved it for last:
So with this implementation do I know what data to display by labeling the info with the same tag as the buttons?
Yes. Except you don't need to add any extra labels to the data source, and you can use any system you want to choose the tag numbers, just as long as you know the system (hint: an explanation of the numbering system should be added with inline comments, not just in an external document).
In the example code the "pair" number is in the hundreds place and the button number in the ones place. So tag 302 means "pair 3 button 2". In this case there are only two button positions in each set, "upper" (1) and "lower" (2). But the numbering system is extensible. So if you ever want a triple instead of a pair in each set, you shouldn't need to change much code.
So given the tag numbering system, how do we retrieve the additional info associated with each button? Well firstly, the button pair number is the same as the position of the matching dictionary in the array (which would normally reflect the order of the xml data stream). Here's an example that extends the previous action methods. Note that as the example gets closer to a real app, we need to add an ivar to save the data source array:
// DsanViewController.h
@interface DsanViewController : UIViewController {
NSMutableArray *dataArray;
@property (nonatomic, retain) NSMutableArray *dataArray;
@end
// DsanViewController.m
#import "DsanViewController.h"
@implementation DsanViewController
@synthesize dataArray;
- (void)dealloc {
[super dealloc];
[dataArray release];
- (void)upperAction:(id)sender {
UIButton *button = sender;
int tag = button.tag;
int index = tag / 100 - 1;
NSDictionary *dict = [dataArray objectAtIndex:index];
// if we didn't have separate action methods, we would
// know upper from lower like this:
// BOOL is_upper = tag % 100 ? NO : YES;
// but in the current case, we already know sender is
// an upper button
NSString *title = [dict objectForKey:@"UpperTitle"];
NSString *info = [dict objectForKey:@"UpperInfo"];
NSLog(@"upperAction: tag=%d title=%@ info=%@", tag, title, info);
- (void)lowerAction:(id)sender {
UIButton *button = sender;
int tag = button.tag;
int index = tag / 100 - 1;
NSDictionary *dict = [dataArray objectAtIndex:index];
// we already know sender is a lower button
NSString *title = [dict objectForKey:@"LowerTitle"];
NSString *info = [dict objectForKey:@"LowerInfo"];
NSLog(@"lowerAction: tag=%d title=%@ info=%@", tag, title, info);
- (void)viewDidLoad {
[super viewDidLoad];
// assume the xml data will be stored in an array of dictionaries
NSMutableArray *array = [NSMutableArray arrayWithCapacity:4];
// retain the array and save its address in an ivar
self.dataArray = array;
// same as previous example from here
// - in the real app, the array would be loaded from the xml parser at this point
When the remaining, previously posted viewDidLoad code is added after the last comment, the above is working, tested code, based on your original requirement description (except for an additional subview for each pair of buttons). Just paste directly from the forum into a new View-based App template. Nothing need be added to the xib, since all the buttons and connections are created dynamically, in code. I think you might benefit by building a testbed from the example code. That will give you a baseline for the UI, and you can use it to experiment with different button placements, etc.
Some books and classroom instructors teach "top-down" design by insisting on a complete functional design before writing the first line of code. This rarely works very well if you're new to the language, the API and the platform (especially if the language is Obj-C, the API is Cocoa and the platform is iPhone!!) In that case the best laid plans of mice and men can get hopelessly bogged down, first in syntax errors, then in runtime errors, and finally when the entire architecture proves incompatible with the support in the system. I prefer top-down-bottom-up-top-down-etc., so the top-down design is informed by what I actually know how to do.
If you build a testbed from the example code, I'm hoping that will save you from some of the more common gotchas that can keep your functional, top level design from becoming a reality.
- Ray -
SharePoint Ribbon custom button "enablescript"
Hi,
I want to set permission for all selected items in library.
I 've added custom button to ribbon.
My custom button{ find all selected items and redirect to "mypage.aspx?ids=12,25,45" } .
In them there is no problem....
But..
if curentuser does not have full control permissions then mybutton must be disable..
EnableScript not working:((
I 'have tried this and like this examples.
I inserted alert('') between rows..
and this row not working.
context.executeQueryAsync(Function.createDelegate(this, this.onSuccessMethod), Function.createDelegate(this, this.onFailureMethod))
http://social.technet.microsoft.com/Forums/sharepoint/en-US/f21ad6b1-445a-497d-a286-d3ba8c2928a6/how-to-get-the-current-user-permission-level-on-a-list-item-with-ecmascriptHi,
This enablescript not working.
function ItemhasPermissions()
{ var buttonState= true;
var selectedItems = SP.ListOperation.Selection.getSelectedItems();
var count = CountDictionary(selectedItems);
if (count > 0)
var i;
for (i in selectedItems)
if( !selectedItems[i].get_effectiveBasePermissions().has(SP.PermissionKind.editListItems))
buttonState=false;
return buttonState; -
ALV custom buttons - translations
Hello all,
I have added custom buttons in a ALV report which have texts like Display/Change, Refresh...... How to provide translations for these buttons. The requirement is when the user logs in Finnish language the user should see these buttons with the finnish texts. I have the finnish texts with me but dont know how to proceed.
ThanksCheck the pointed reply on this thread -
PUSH BUTTON text and tooltip dynamic in module pool
Regards,
Amit -
Hi,
We want to add cusotm button on output screen of MR11.
How can we add button on output screen of MR11?
Regards,
Jigar Thakkar.Hi Husalban,
We added customer button in the rfx iview.
When you finish the configuration adding, you can go to the WDA component 'FPM_OIF_COMPONENT'/View:CNR_VIEW/Methord:ONACTIONBUTTON_PRESSED.
You can make repair here or continue to find the rfx PDO class.
Please be careful when you decide to make repair code and considerate the upgrade.
In the methord ONACTIONBUTTON_PRESSED,please refer to follow code:
***---->Add By lorry for test Action
IF lv_event_id = 'ZAPPWLF' OR lv_event_id = 'ZAPPWLF_VIEW'.
*****************Get the Parameter Vaule
DATA:lt_keys TYPE STANDARD TABLE OF string,
lv_key LIKE LINE OF lt_keys.
TYPES:BEGIN OF y_parameters,
name TYPE string,
value TYPE string,
END OF y_parameters.
DATA lt_parameters TYPE STANDARD TABLE OF y_parameters.
DATA ls_parameter LIKE LINE OF lt_parameters.
lt_keys = lo_fpm->mo_app_parameter->get_keys( ).
LOOP AT lt_keys INTO lv_key.
ls_parameter-name = lv_key.
lo_fpm->mo_app_parameter->get_value(
EXPORTING
iv_key = lv_key
IMPORTING
ev_value = ls_parameter-value
INSERT ls_parameter INTO TABLE lt_parameters.
ENDLOOP.
DATA:ls_boid TYPE bbp_guid,
ls_botype TYPE string,
ls_mode TYPE string.
CLEAR ls_parameter.
READ TABLE lt_parameters INTO ls_parameter WITH KEY name = 'SAPSRM_BOID'.
ls_boid = ls_parameter-value.
CLEAR ls_parameter.
READ TABLE lt_parameters INTO ls_parameter WITH KEY name = 'SAPSRM_BOTYPE'.
ls_botype = ls_parameter-value.
IF ls_botype = 'BUS2200'.
ENDIF.
ENDIF. -
Custom Buttons in WebHelp Skin
Hi all,
I am trying to add a button to my WebHelp version of my
project to enable readers to print the current topic. In my skin
editor, I managed to add a custom button, Print, with an image
entered window.print() in the JavaScript onClick field that is
provided (this is a standard JS call that prints the window). After
updating the view in the Skin Editor, the button is displayed, but
after re-generating the WebHelp layout, I can't see my new button.
I thought maybe the Advanced tab's Dependancies list might have
something to do with it, but I am not sure what it is for exactly.
Is there a trick to adding custom buttons to skins to get them to
display in the generated format?
Thanks in advance for your thoughts,
darkagnHi Captiv8r and thankyou for the super-fast response :)
Your reply allowed me to add the custom button to my skin.
However, the window.print() function only prints the area
with the buttons, not the topic itself. So I thought I'd re-post
and explain how I actually solved the problem of printing topics in
WebHelp in case anyone else needed the same info.
I ended up adding a button to the template that all of my
topics are derived from, in the footer so that the button remained
below the topic itself. I had to add the button in the HTML editor
with the following code:
<form style="text-align: right; padding-right: 10px;">
<input id=printbutton type=button onClick="window.print()"
value="Print Topic" style="width: 90px;">
</form>
Now, because the Print button appears in the same area of the
screen as the topic itself, the call to window.print() prints
everything in that frame (which unfortunately includes the button
itself, but this is a small price to pay to be able to print topics
from WebHelp).
Anyway, I hope this solution helps someone out
there... -
Custom buttons in hierarchical alv through OO prog
Hi, i have created an hierarchical alv through factory method. I display the gr_table of type cl_salv_hierseq_table.
I wish to add custom buttons at the top.
I searched a lot and mostly found solutions for adding custom buttons in grid of type cl_gui_alv_grid.
There the event 'toolbar' of class cl_gui_alv_grid is used.
In cl_salv_hierseq_table , i could not find any events,
Could anyone please help me in adding custom buttons in the hieerarchical alv.Looking at the details in cl_salv_functions - enable_functions, it looks like adding your own function is only supported in a grid and tree view.
method enable_function .
data: l_name type string.
data: l_msgtext type string.
data: ls_message type scx_t100key.
data: lr_controller type ref to if_salv_controller_model.
data: text type string.
lr_controller ?= me->r_controller.
if lr_controller->r_model->get_display_object( )
ne IF_SALV_C_TABLE_OBJECTS=>GRID
and lr_controller->r_model->get_display_object( )
ne IF_SALV_C_TABLE_OBJECTS=>TREE.
text = text-001.
l_name = name.
raise exception type CX_SALV_METHOD_NOT_SUPPORTED
exporting class = 'CL_SALV_FUNCTIONS'
method = 'ENABLE_FUNCTION'
object = l_name
key = text.
endif. -
While adding custom field in urgent change-Create new field button in AET is not coming
Dear All,
we have requirement to add some custom fields in urgent change document. while adding custom fields using AET, create new field button is not coming.
Thanks in advance. points will be awarded.
RahulHi Jignesh,
Thanks for your valueble inputs, it really helped me to understand the process.
I checked in Web UI configuration for urgent change document as you mentioned but still that button is not coming.
In transaction BSP_WD_CMPWB, i have created enh. set: Z_ENHANCEMENT_SET.
Can you tell what to selelect in application and page popup which comes after selecting Enhance component button. Actually i tried but i am not able to add new record in conf.
Thanks in advance.
Maybe you are looking for
-
Windows 8.1 laptop cannot connect to the internet using USB Mobile Broadband stick.
I bought a new laptop and it came with Windows 8.1 installed. Well, things worked perfectly until I wanted to connect to the internet using my mobile broadband USB stick. I installed the software that came with the stick, and my laptop recognize the
-
How do I find noise margin etc?
Over the past few months my download speed has dropped from around 7M to around 3. Work has been going on since the start of the year to bring FTTC to the area and I assumed that this was to blame. But that work has now finished, although I personall
-
When my program has an error, I am able to catch it but it's like the program doesn't exit normally. Something is not being cleared out because the program won't run properly again once the error has occurred. Is there a command that will clear out a
-
Why didn't photoshop cc install?
I just got the Photography 9.99 package and Photoshop CC will not install, period. The CCA says that it downloaded but that is where the process stops. Light Room installed though with now issues, who cares I do not pay 9.99 for access to light roo
-
Work shop evaluation guide chapter1
Hi, using evaluation guide of workshop8.1 , i builed chapter1 application.i am getting deployment error while run the application. i tried to redeploy. but i got failure notice. here i attached the error snopshot. please help me out of this problem.