Skip to content

Commit

Permalink
fixing + and - button display on mac
Browse files Browse the repository at this point in the history
  • Loading branch information
dennis97519 committed Mar 31, 2018
1 parent f7daa8f commit 0a06eb6
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions src/me/deleteme/polyglot/gui/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,10 @@ private void initMwsComponents() {
buttonPane = new JPanel();
formatPanel.add(buttonPane);
btnAdd = new JButton("+");
btnAdd.setPreferredSize(new Dimension(20,20));//so mac doesn't expand the button
btnAdd.addActionListener(this);
btnRmv = new JButton("-");
btnRmv.setPreferredSize(new Dimension(20,20));
btnRmv.setEnabled(false);
btnRmv.addActionListener(this);
btnEdit= new JButton("Edit...");
Expand All @@ -292,6 +294,7 @@ private void initMwsComponents() {
btnAddEmptyLine.setAlignmentX(Component.CENTER_ALIGNMENT);
buttonPane.add(btnEdit);

//looks like this is unused, may have planned for some additional format back then
paneFormatEdit = new JPanel();
formatPanel.add(paneFormatEdit);
paneFormatEdit.setLayout(new BoxLayout(paneFormatEdit, BoxLayout.Y_AXIS));
Expand Down Expand Up @@ -612,7 +615,9 @@ void clearStatus(){
lblStatus.setText(" ");
}


/**
* overall action listener to jump to the appropriate function
*/
public void actionPerformed(ActionEvent e) {
if (e.getSource() == chckbxUnformattedText) {
do_chckbxUnformattedText_actionPerformed(e);
Expand Down Expand Up @@ -1048,22 +1053,23 @@ protected static void do_mntmSaveAs_actionPerformed(ActionEvent e) {
* @param arg0
*/
protected void do_chckbxUnformattedText_actionPerformed(ActionEvent e) {
syncFormatTextChkbx();
}

void syncFormatTextChkbx(){
boolean ufTStatus=chckbxUnformattedText.isSelected();
syncFormatTextStat(ufTStatus);
}

/**
* Syncs UI components after the checkbox for unformatted text is checked or unchecked
* @param ufTStatus true - unformatted text mode
*/
void syncFormatTextStat(boolean ufTStatus){

langNotDetOptPane.setVisible(ufTStatus);
paneFormatEdit.setVisible(!ufTStatus);
btnAddEmptyLine.setVisible(!ufTStatus);
btnComb.setEnabled(!ufTStatus);
langNotDetOptPane.setVisible(ufTStatus);//display the option for what to do when language not detected
paneFormatEdit.setVisible(!ufTStatus);//idk whats this
btnAddEmptyLine.setEnabled(!ufTStatus);//disable the button to add empty line (hiding it seems to screw up the + and - buttons on mac)
btnComb.setEnabled(!ufTStatus);//disable combine button as you can't combine without format
if(ufTStatus){
border.setTitle("Languages:");
plList.setCellRenderer(new SepPaneListRenderer());
plList.setCellRenderer(new SepPaneListRenderer());//probably to hide the empty line option
}
else{
border.setTitle("Format:");
Expand Down

0 comments on commit 0a06eb6

Please sign in to comment.