resize jPanel on VLCJ fullscreen for controlsPanel - netbeans

I am using netbeans to create a media player using vlcj-3.8.0.jar.Here is the source code for netbeans users,vlcj gui netbeans based just unzip and open project in netbeans(contains playlist, volume, plays in canvas)I know placing the whole code violates the SSCCE standards but it might be informative for others. Another reason is that if you are a netbeans user then running the code and finding the problem is very easy for you, u wont need to search the entire code. So my problem, all works fine but i am having problem when i toggle the fullscreen. The controlsPanel as you can see in the picture below wont resize and i dont how how to do it. I tried to put the panel in border layout but it messes everything inside it(i have jslider and jlabels inside it).
http://postimg.org/image/kcxuwgjgx/
Here is a code to toggle on and off for fullscreen, where
jPanel2: is in border layout that has canvas inside it,
controlsPanel: panel in absolute layout that has jslider and jlabels has properties i set through netbeans as horizonal size and vertical size as default, horizontal resizable as ticked
private void toggle_fullscreenMouseClicked(java.awt.event.MouseEvent evt) {
if(fullscreen_check==1){
controlPanel.setVisible(true);
titlePanel.setVisible(false);
mediaPlayer.setFullScreen(true);
//at fullscreen the controlPanel should be resized horizontally to the end of the screen
controlPanel.setPreferredSize((new Dimension(1200,100)));
controlPanel.setSize((new Dimension(1200,100)));
controlPanel.revalidate();
//here is the problem:controlPanel stays the same...why??
fullscreen_check=0;
}
else{
mediaPlayer.setFullScreen(false);
Dimension ss = new Dimension (10,10);
jPanel2.setPreferredSize(ss);
jPanel2.setSize(ss);
jPanel2.revalidate();
fullscreen_check=1;
}
} `
I tried to use the code:
controlPanel.setPrefferedSize((new Dimension(1200,900);
controlPanel.revalidate();
//OR:
controlPanel.setSize((new Dimension(1200,900);
controlPanel.revalidate();
but it wont work...any help or idea will be greatly appreciated!! If any of you guys tried my code and make the controlsPanel to be resized to full screen, i will be very grateful!!

Related

MATLAB App Designer UIAxes Plot is completely blank

If I simply start a new App Designer project and drag the option "Axes (2D)" to the main canvas, I get the component app.UIAxes, but it is completely blank. While I'm dragging it, I can see the default labels, title, ticks, and so on, but whenever I drop it it just becomes blank. I also can't seem to make it work via code either, as shown below (link to image). Any ideas on why this is happening and a possible workaround?
function EditFieldValueChanged(app, event)
value = app.EditField.Value;
x=linspace(0,10);
y=value*x;
plot(app.UIAxes,x,y)
end

open image instead of popup : leaflet

I am working with leaflet api.I can draw rectangles and polygons.I have bound the popup with every rectangle and polygon.When i click on drawn shape, popup opens(leaflet functionality).Popup contains some html(image).
As i am working on a demo application, i am wiling to try the fancebox plugin.
Means, when i click on drawn shape, instead of popup, i want to open up that image using fancybox.
Can i do that using simple method like using another function instead of .bindpopup.
Working Script (image loaded using fance box when we click on popup)
e.layer.bindPopup("<a class='fancybox' rel='group' href=''><img /></a>");
I can understand there must be some other javascript function to do it.
If there is some way to do it please let me know, as i am new to leaflet didn't have enough mental power to understand it yet but i hope i will....
Thanks for your time :)
I would just do e.layer.on('click', function() { //do fancybox init, perhaps like $(body).append("<a class='fancybox' rel='group' href=''><img /></a>")})
Although it makes a lot more performance sense to bind that event on the L.FeatureGroup holding all the shapes instead of one by one.

How can I get g-leaflet map to show immediately and without having to resize the window?

I have a problem with g-leaflet - it shows as a grey rectangle only (with a bit of the map at top left) until I resize the window (manually). Then it shows up. Sometimes parts of maps show when I hover over an area but this too is incomplete and problematic. Here:
The code that I use to add the G-Leaflet map to my GXT VerticalContainer (com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer) is as follows, taken from G-Leaflet example:
LeafletDrawResourceInjector.ensureInjected();
final MapWidget mapWidget = new MapWidget();
mapWidget.setSize("1000px", "750px"); // I added this myself to try to fix the issue
myVerticalLayout.add(mapWidget);
(I also set the size of the "myVerticalLayout" container).
Please help!
Leaflet is really finicky. Scheduling a defferred call to invalidateSize() was not enough. Had to make my own JavaScript call to its invalidateSize using setTimeout, also making sure that all the containers are attached before this happens. Only hen it would show.

JFrame Picture in NetBeans as Background

I'm done coding my program but I'm having a difficult time adding a picture to a JFrame (I've done everything in code without using the graphic interface JPanel.
At the moment I'm trying something like this, but it keeps giving me errors and wont display the picture. (JavaOskarTid is my package, hourglassone.jpeg my intended picture)
Thank you very much for any response!
URL urlToImage = this.getClass().getResource("JavaOskarTid/hourglassone.jpeg");
ImageIcon icon = new ImageIcon(urlToImage);

C, GTK: window stops updating

I'm developing an application that periodically draws images on a GTK Drawing Area inside a window.
The rendering first works well and the window content gets repainted if I drag another window over the drawing one, but after some random amount of time (some seconds), the window stops updating itself.
New images dont get displayed, and if I then drag another window over the rendering one I get this:
When I click one of the checkboxes below my drawing area, the window gets refreshed and the problem is gone for another few seconds.
Any idea what could make the GTK threads stop updating the window content?
I dont know which part of my code is of interest to answer that question, so I pasted the mostly full version here.
My GTK-main() is called like this:
void window_main()
{
pthread_create(&drawing_thread, NULL, img_draw, NULL);
gtk_main();
gdk_threads_leave();
}
Thanks for any hints! :)
Found the solution: in the original example code I used (here) they use a g_timeout_add() to register their periodic drawing function.
The g_timeout_add()-registered function is run by gtk_main(), which means it is protected internally by gdk_threads_enter() and gdk_threads_leave(). That's the point I was not aware of.
Surrounded my call to gtk_widget_queue_draw_area() with these two functions and the bug is gone 8)