Categories
discuss

FXML set TableView column resize policy

How can I set a TableView’s resize policy from FXML? I tired this way, but it’s not working:

<TableView layoutX="20.0" layoutY="20.0" prefWidth="674.0" prefHeight="668.0" fx:id="tableView" fx:constant="CONSTRAINED_RESIZE_POLICY">
    <columns>
        <TableColumn text="First Name" />
        <TableColumn text="Last Name" />
        <TableColumn text="Email Address" />
    </columns>    
</TableView>

Answer

To set columnresize policy for tableview using fxml , you have to use <columnResizePolicy> tag . This will work on javafx 2.2 and later..

<TableView>
  <columnResizePolicy><TableView fx:constant="CONSTRAINED_RESIZE_POLICY"/></columnResizePolicy>
</TableView>

Reference :

Defining TableView columnResizePolicy property with fxml

Categories
discuss

Google chrome extension not showing the popup

The problem is that when I click on the icon it doesn’t show anything at all.

manifest.json

{
  "manifest_version": 2,
  "name"            :  "My cool plugin",  // the name of the extension
  "version"         :  "1.0"              ,   // version number
  "description"     :  "My cool plugin", // description used in the Chrome Webstore
  "background": "background.html",
  "browser_action"  :  {
    "default_title": "My cool plugin",
      "default_icon"   :  "icon.png",      // specifies the default icon
      "popup"          :  "popup.html"   // the page to show when the icon is clicked
  },
  "permissions": [
    "tabs", 
    "http://*/",
    "https://*/*"
  ]
}

popup.html and background.html

<div>
    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>

What is the problem?

Answer

it’s "default_popup": "popup.html" not “popup”

https://developer.chrome.com/extensions/browserAction.html

Categories
discuss

config.js doesn’t work for CKEditor

I have the following in my config.js for CKEditor:

CKEDITOR.editorConfig = function( config )
{
    config.toolbar =
    [
        [ 'Source', '-', 'Bold', 'Italic' ]
    ];
    // config.toolbar_Basic =
    // [
    //     [ 'Source', '-', 'Bold', 'Italic' ]
    // ];
    // config.toolbar = 'Basic';
}

The editor is still showing with all the options in the toolbar.

It is also loading the JS files in the right order:

<script src="/assets/ckeditor/init.js?body=1" type="text/javascript"></script>
<script src="/assets/ckeditor/ckeditor.js?body=1" type="text/javascript"></script>
<script src="/assets/ckeditor/config.js?body=1" type="text/javascript"></script>

So I am not sure what is happening here. Any thoughts?

Also important to note that I tried the alternative way of declaring that Basic toolbar (see the commented out code in the snippet above) and it didn’t work either.

After every change, I restart my server.

Answer

How do you load you ckeditor in place of the textarea? Maybe the toolbar is overridden there.

Categories
discuss

jQuery(window).height() doesn’t work on mobile browsers

I have a full page slideshow using jQuery(window).height() and it works fine on most browsers, however I checked it out on my phone (Android Browser & Dolphin) and the slideshow just keeps growing endlessly, well beyond the height of the view-port. This is my code:

var height = jQuery(window).height();
jQuery('.slide').each(function(index, element) {
    if(height > 600) jQuery(this).height(height);
    else jQuery(this).height(600);
});
jQuery(window).on('resize orientationChanged', function() {
    jQuery('.slide').each(function(index, element) {
        if(height > 600) jQuery(this).height(height);
        else jQuery(this).height(600);
    });
});

Any ideas what could be causing it?

Thanks.

Answer

so after 3 year of this question asked jquery window height still not working in mobile devices just replace jquery with javascript and it worked for me.

replace jquery

var bodyh = jQuery("body").height();
var windowh = jQuery(window).height();

with javascript

 var bodyh = document.body.clientHeight;
 var windowh = window.innerHeight;
Categories
discuss

Why does my Java application successfully close Windows Explorer, but fail to restart it again?

In my java application I use

Runtime.getRuntime().exec("taskkill /F /IM " + explorer.exe).waitFor();

to close Windows Explorer. This part works because Explorer realy stops working for me.

Unfortunately, when I use

Runtime.getRuntime().exec("explorer.exe");

Windows Explorer doesn’t restart at all. How should I restart it properly?

Answer

I don’t know the reason why that is not working for you, since you are executing an external program from java, I think it is not Java’s fault that it is not restarting, maybe there is something wrong in the way you restart. I will give you an alternative:

Instead of using Runtime.exec(), try ProcessBuilder.start() for starting the process and use the method destroy() from the class Process to kill the process. It should work ok, just use the builder to create an object that represent explorer and assign it to a variable of type Process.

The only reason I think maybe it is easier if you use the ProcessBuilder is because it takes arguments as separate Strings, and maybe that makes it easier to configurate your scripts.

Example:

List<String> params = java.util.Arrays.asList("C:myProgram.exe", "-arg1", "-arg2");
ProcessBuilder pb = new ProcessBuilder(params);
Process process = pb.start(); 

Give it a try I think it should work.

Source: stackoverflow
Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Privacy Policy, and Copyright Policy. Content is available under CC BY-SA 3.0 unless otherwise noted. The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 © No Copyrights, All Questions are retrived from public domain..