I'm using controlsFX for dialogs and I can't figure out how to set the width. A lot of my messages only include the title, masthead and buttons. But the text in the buttons isn't fully display. For example:
Action deleteStuff = new DialogAction("Delete Stuff", ButtonBar.ButtonType.OTHER);
Action deleteMoreStuff = new DialogAction("Delete More Stuff", ButtonBar.ButtonType.OTHER);
Action response = Dialogs.create()
.owner(stage)
.title("Delete")
.masthead("This is a delete dialog")
.actions(deleteStuff,deleteMoreStuff,Dialog.ACTION_CANCEL)
.showConfirm();
And one of the buttons will show: "Delete Mo..."
And yes, I know I should be using the Alert class, but the project is for machines running older versions of Java. Thanks in advance.
Related
I am developing a Harmony application and I want to animate the Dialog window
this code is from android and this type of animation I want to add
Window dialogWindow = dialog.getWindow();
dialogWindow.setWindowAnimations(R.style.CustomDialogAnimation);
// properties that needs to be attached to Dialog window
duration="75"
fromXScale="0"
fromYScale="0"
toXScale="1"
toYScale="1"
I didn't find anything matching documentation like setWindowAnimations.
I tried writing this code but hit a dead end after getting the dialog window. How to add animation properties to this dialog window.
CommonDialog commonDialog = new CommonDialog(getContext);
Window dialogWindow = commonDialog.getWindow();
Is there any other way to code this?
According to the team, HarmonyOS does not currently support to add animation properties to dialog window. Please stay tuned on HarmonyOS official websites.
I need to Implement the dialoges given in Image to introduce attributes of App, I couldn't find the way to implement it yet.
I have tried Firebase InAppMessaging but it's automatically being displayed just after the App starts. What I need is the Message dialog should display after a button gets clicked.
the code I putted in the button.OnclickListener
FirebaseInAppMessaging.getInstance().triggerEvent("CompaignId");
Link to Firebase InAppMessaging Docs from where I get the given code
You can use BubbleShowCase to achieve your dialog.
How to use it in the simplest way:
BubbleShowCaseBuilder(this) //Activity instance
.title("foo") //Any title for the bubble view
.targetView(view) //View to point out
.show() //Display the ShowCase
And if you will read more in the library page you can find info about making a custom dialog.
You can use full-screen dialog with transparent background and show whatever feature you have to show
e.g
Dialog dialog = new Dialog(context);
dialog.setContentView(R.layout.dialog_layout);
dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT);
dialog.show()
There's a lot of libraries out there, but if you want a google like showcase, you can use ShowCaseView
ShowcaseViewBuilder showcaseViewBuilder;
showcaseViewBuilder = ShowcaseViewBuilder.init(this)
.setTargetView(fab)
.setBackgroundOverlayColor(0xdd4d4d4d)
.setRingColor(0xcc8e8e8e)
.setRingWidth((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20, getResources().getDisplayMetrics()))
.setMarkerDrawable(getResources().getDrawable(R.drawable.arrow_up), Gravity.LEFT)
.addCustomView(R.layout.description_view, Gravity.TOP)
.addCustomView(R.layout.skip_layout)
.setCustomViewMargin((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 70, getResources().getDisplayMetrics()));
I'm creating an SWT (ported Mac OSX version) application. I am trying to set a specific button to have the bezel style of "inline". Here is what I want my button to look like on mac.
(screenshotted in storyboard view in xcode)
The code I am using to try to get this inline button:
// created button named "inlineButton" and applied layout to it.
// here is where I set the bezel style and text.
NSButton nsInlineButton = (NSButton) inlineButton.view;
nsSaveButton.setBezelStyle(15); // NSBezelStyleInline is enum 15 for cocoa
this.inlineButton.setText("Inline Button");
And the result:
(screenshotted from my java program)
I have also tried to redraw and relayout the shell and a variety of other methods with no avail.
Is this a bug or am I doing something wrong?
Solved. I just needed to add the SWT style of "FLAT"
this.inlineButton = new Button(this, SWT.FLAT);
NSButton inlineButton = (NSButton) inlineButton.view;
inlineButton.setBezelStyle(15);
I have a jFace wizard, I am using this to create a new project type eclipse plugin. As you can see from image below, I have one treeviewer on left side, and a SWT group on right side. What I want is when ever user selects one of the item from treeviewer, I should be able to create dynamic controls on right side SWT Group. Say user selects Test One, one right side I should be able to create few controls like label, text and few radio buttons on right side, similarly if user selects Test Two I should be able to create dynamic controls on right side.
Currently I tried below code:
tree.addSelectionListener(new SelectionAdapter() {
#Override
public void widgetSelected(SelectionEvent e) {
for (int i = 0; i < selection.length; i++) {
String tempStr = selection[i].toString();
tempStr = tempStr.replaceAll("TreeItem \\{", "");
String finalStr = tempStr.replaceAll("\\}", "");
if (finalStr.equals("Test One")) {
Button btn = new Button(g2, SWT.NONE); //g2 is right side group
btn.setText("Blaaaa");
btn.setVisible(true);
container.redraw();
}
}
But when I run, I see no changes on right group. Can anyone guide me what I am doing wrong? Any pointers would be very appreciated, since I am new to Eclipse development and SWT.
You probably didn't set a layout on the g2 group. This is the common cause for controls not showing up. You can also try using g2.layout() to ensure that the new controls are correctly laid out after you create them.
Additionally you could look at using a StackLayout so that once you create a set of controls you can just hide them all at once instead of destroying when the selection changes. This is often useful so that if the user comes back to a previous selection, they will find the data they entered in the same state when they switched the selection. Here is an example.
I have problem currently for my swing reminder application, which able to minimize to tray on close. My problem here is, I need JOptionPane dialog to pop up on time according to what I set, but problem here is, when I minimize it, the dialog will pop up, but not in the top of windows when other application like explorer, firefox is running, anyone know how to pop up the dialog box on top of windows no matter what application is running?
Create an empty respectively dummy JFrame, set it always on top and use it as the component for the JOptionPane instead of null. So the JOptionPane remains always on top over all other windows of an application. You can also determine where the JOptionPane appears on screen with the location of the dummy JFrame.
JFrame frmOpt; //dummy JFrame
private void question() {
if (frmOpt == null) {
frmOpt = new JFrame();
}
frmOpt.setVisible(true);
frmOpt.setLocation(100, 100);
frmOpt.setAlwaysOnTop(true);
String[] options = {"delete", "hide", "break"};
int response = JOptionPane.showOptionDialog(frmOpt, msg, title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, "delete");
if (response == JOptionPane.YES_OPTION) {
removeRow();
}
frmOpt.dispose();
}
Old post, but I was struggling with this.
My problem was more with Javafx allowing the JOptionPane to go behind the current Java window.
Therefore I used the following which does what the original poster asked by putting the JOptionPane in front of all windows; even JAVAFX.
Firstly the old JOptionPane:
JOptionPane.showMessageDialog(null, "Here I am");
Now an JOptionPane that stays in front:
final JDialog dialog = new JDialog();
dialog.setAlwaysOnTop(true);
JOptionPane.showMessageDialog(dialog, "Here I am");
And for fun here is everything in one long line:
JOptionPane.showMessageDialog(
((Supplier<JDialog>) () -> {final JDialog dialog = new JDialog(); dialog.setAlwaysOnTop(true); return dialog;}).get()
, "Here I am");
You can make a static method some where that will return the JDialog for you and then just call it in the JOptionPane to clean up your code a bit.
Are you using one of the canned JOptionPanes? (Like JOptionPane.showCOnfirmDialog(...))
You may want to look at extending JDialog and making your own dialog panel, and then calling myDialog.setAlwaysOnTop(true);
Windows is blocking this operation since XP.
The scenario before was like:
Your a tiping in some text in an editor and not recognize that another dialog is coming to front when you are tipping the text. The coming dialog gets the focus and you are tiping in the new dialog. Maybe you click enter after you are ready and do this in the wrong dialog, which is asking whether you realy want to delet your hard disk ;)
The come to front call in java is only working for java windows.
The possibibilty to notify the user of a new window is to implement a Frame, which will highlighted/flashing in the windows task bar.
Correction the post above..
I have resolve my problem as below:
this.setVisible(true); // show main frame
MyDialog dialog = New MyDialog(this, true); // show my custom dialog
dialog.setVisible(true);
this.setVisible(false);
it works fine for me :)
You might think about using a JFrame instead. It may give you a little more flexibility.
If you are using a JFrame and you want it to popup on top of the other windows use:
myFrame.setVisible(true);
myFrame.setState(Frame.NORMAL);
The setState will show the window to the user if it was in minimized state previously.