How can I set JavaFX alert height in which dialog's contentText is null? I made an alert and set contentText as null, but dialog's contentText field's height does not became smaller. How can I make contentText field's height as minimum?
Alert alert = new Alert(AlertType.CONFIRMATION);
alert.setTitle("title");
alert.setHeaderText("I want to make dialog without contenttext");
alert.setContentText(null); //this is null but this field is still remain
I just tried like this.
alert.getDialogPane().setMaxHeight(10); //does not work.
Using this method you can customize the size of the alert.
alert.getDialogPane().setMaxSize(2,2);
Default Preview
Preview after the code
Related
In my application I need to show a sheet dialog sliding from top of the whole screen. Now I have a problem, my sheet dialog is showing but under status bar.
Actually view of top sheet dialog
My target is to make a background of status bar the same as sheet dialog (purple) and normally have a clock, battery status etc.
My code:
final Dialog dialog = new Dialog(MainAccountView.this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.sheet_short_settings);
dialog.show();
dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
dialog.getWindow().getAttributes().windowAnimations =
R.style.TopSheet_DialogAnimation;
dialog.getWindow().setGravity(Gravity.TOP);
I tried on few devices so problem is on the code. XML layout for sheet_short_settings starting on the top of whole screen. When I turn on a "Show system UI" the status bar have a background of my layout, but have the dark transparent color.
Thanks in advance
I am trying to show a full screen alert dialog like the one on the material design website: Full Screen Material Alert Dialog
I created a
new MaterialAlertDialogBuilder(this)
.setTitle("Title")
.setMessage("Message")
.setPositiveButton("Yes", null)
.show();
which works perfectly. However I want the dialog to appear as full screen with the toolbar and x button, so I can place EditTexts inside the dialog.
I tried using the other constructor MaterialAlertDialogBuilder(context, theme) but I cannot find a theme that will make the dialog appearance full screen. Is there a theme that makes the dialog full screen or do I have to do something else to make it full screen?
try this
MaterialAlertDialogBuilder dialog = new MaterialAlertDialogBuilder(this, android.R.style.Theme_DeviceDefault_NoActionBar_Fullscreen);
I want to change the icon next to the title of my costum JDialog, but i cant get it to work. It worked this way for a JOptionPane before.
private ResourceLoader rl = ResourceLoader.getInstance();
...
setBounds(100, 100, 603, 419);
setTitle("über CogFit");
new ImageIcon(this.rl.loadImage("gfx/srh_logo_32x32.png"));
I already tried this:
JDialog - how to change icon
but it also didnt work.
Thanks for the help
If you want to set the icon displayed in the tile bar you must use the JDialog#setIconImage(Image) method.
https://docs.oracle.com/javase/7/docs/api/java/awt/Window.html#setIconImage(java.awt.Image)
I want to change this filter icon to another one, I have tried this method setFilterButtonProperties(newButton);
but it doesn't work.
here the image which I want to change.
Try this one
Button newButton=new Button("");
newButton.setSize("18px", "18px");
newButton.setIcon("[SKIN]/RecordEditor/add.png");
listGrid.setFilterButtonProperties(newButton);
Note: Change the icon path and size as per your requirement.
Action myAction= new Action("LABEL", ImageCache.getImageDescriptor("IMAGE"));
This code shows me a button without any text. Instead it only shows the image.
What should I do to display them both side by side?
I tried using setText() and setDescription() and setImageDescriptor() but none helped.
Text is not normally shown for an action in a ToolBar if there is also an image.
If you are adding the Action to the tool bar manager using an ActionContributionItem you can call ActionContributionItem.setMode(ActionContributionItem.MODE_FORCE_TEXT);