2

I have a surface pro 3, which I do most of my coding. I believe all of the Apps downloaded from the micosoft store has their menubar at the very top left border of the Windows application..Currently I am working on a Windows application using Java and wanted my design to have the 3 bars (the menu) on top of the JFrame border on top left. I have googled it and only found a few people that was trying to do the same and all was told it's not possible to do using JFrame. If that is the case how should I go about making my own component that can actually do this?

I do not mind, spending hours upon hours and days developing this. Because once I can create library of it, it will be very useful.

Chuck
  • 75
  • 1
  • 2
  • 10
  • You could make your `JFrame` undecorated by calling `frame.setUndecorated(true)`, which will get rid of the title bar and sizing etc. You could then add decorations as you need them, including a menu. – clstrfsck Jun 22 '16 at 08:07

1 Answers1

0

If I understand well your question, you think a menu like this?

import javax.swing.*;

public class Menu {
public static void main (String[] args) {
    JFrame frame = new JFrame();
    frame.setSize(500, 300);

    JMenuBar menuBar = new JMenuBar();
    JMenu menu1 = new JMenu("menu1");
    JMenu menu2 = new JMenu("menu2");
    JMenu menu3 = new JMenu("menu3");
    menuBar.add(menu1);
    menuBar.add(menu2);
    menuBar.add(menu3);

    frame.setJMenuBar(menuBar);
    frame.setUndecorated(true);     
    frame.setVisible(true);
}
}

Here is picture.

Szala
  • 171
  • 2
  • 16
  • I have ran the code and it looks like what I want to do. But the only issue is that the minimize,maximize and close button on the far right wont be displayed. – Chuck Jun 24 '16 at 15:02
  • Check this, maybe will help [link](http://stackoverflow.com/questions/15170616/showing-only-close-button-on-the-jframe-undecorated) – Szala Jun 25 '16 at 08:55