0

I am trying to make a map app on windows desktop. I am using the mapsforge library, but it does not have a rotation class. What I want to know is how to rotate JFrame or mapview itself.

This is the code of the main class.

private static JFrame createJFrame(final MapView mapView) {
    final PreferencesFacade preferencesFacade = new JavaPreferences(Preferences.userNodeForPackage(Main.class));

    final JFrame frame = new JFrame();
    frame.setLayout(new BorderLayout(0, 0));

    /*JPanel centerPanel = new JPanel();
    centerPanel.setLayout(new GridLayout(2, 2));
    centerPanel.add(mapView);
    centerPanel.add(new JPanel());
    centerPanel.add(new JPanel());
    centerPanel.add(new JPanel());*/

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    //frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
    frame.setUndecorated(true);
    
    frame.add(list, BorderLayout.EAST);
    frame.add(mapView, BorderLayout.CENTER);
    frame.pack();
    frame.setSize(new Dimension(1366, 700));
    frame.setLocationRelativeTo(null);
    frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    frame.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            int result = JOptionPane.showConfirmDialog(frame, MESSAGE, TITLE, JOptionPane.YES_NO_OPTION);
            if (result == JOptionPane.YES_OPTION) {
                mapView.getModel().save(preferencesFacade);
                mapView.destroyAll();
                AwtGraphicFactory.clearResourceMemoryCache();
                frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            }
        }

    

    

I desperately need a way to rotate the map in this code.

ozan33.java
  • 33
  • 1
  • 7
  • Hi and welcome to Stack Overflow! Please remember that this is not a free code writing service and you are required to show us what you've tried so far. Please [edit](https://stackoverflow.com/posts/62692399/edit) your post to add a [mre], a [Short, Self Contained, Correct Example](http://www.sscce.org) or at least show us what you've tried so far. Additionally, please read [How to ask](https://stackoverflow.com/help/how-to-ask), a guide on asking questions on Stack Overflow efficiently so that other users may help you faster and better. – yur Jul 02 '20 at 09:08
  • I appreciate you editing the question, but the code you posted is neither a [mre] nor is it a [Short, Self Contained, Correct Example](http://www.sscce.org), as it's neither reproducible nor correct. Click the links again to see how to present us with either one of the two. I also found [this thread](https://stackoverflow.com/questions/12852076/how-can-i-rotate-an-onscreen-component-in-java) about rotating Swing components, maybe that helps. – yur Jul 02 '20 at 11:42

0 Answers0