#IN swing java how can i make terms and condition box

4 messages · Page 1 of 1 (latest)

wanton panther
#

Like when we install any software we see a box where terms and condition is written. we scroll it till end and then accept or move forward. how can i achieve this in swing java. This is my code
package GUI;
import javax.swing.;
import java.awt.
;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

public class Activation_screen {
JPanel activation_screen = new JPanel();
String path = "src/Assets/termsAndCondition";

public Activation_screen() {
    activation_screen.setPreferredSize(new Dimension(900, 650));
    activation_screen.setLayout(new BorderLayout());
    activation_screen.setBackground(Color.gray);

    JLabel title = new JLabel("Activate Windows");
    title.setFont(new Font("Segoe UI", Font.BOLD, 30));
    title.setForeground(Color.white);
    title.setBorder(BorderFactory.createEmptyBorder(20, 0, 20, 0));
    title.setHorizontalAlignment(SwingConstants.CENTER);
    activation_screen.add(title, BorderLayout.NORTH);
    
}

private String readTermsAndConditions(String path) {
    try {
        Path path1 = Paths.get(path);
        return Files.readString(path1);
    } catch (IOException e) {
        return "Error reading file.";
    }
}

public Component getActivation() {
    return activation_screen;
}

}

torpid abyssBOT
#

This post has been reserved for your question.

Hey @wanton panther! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

torpid abyssBOT